def _instantiate(obj, typ):
    """Returns obj if obj is not None, else returns new instance of typ
    obj : an object
        An object (most likely one that a user passed into a function) that,
        if ``None``, should be initiated as an empty object of some other type.
    typ : an object type
        Expected values are list, dict, int, bool, etc.
    """
    return typ() if obj is None else obj