def wrap_in_list(maybe_list):
    """ This function checks if maybe_list is a list (or anything derived
        from list). If not, it wraps it in a list.

        The motivation for this function is that some functions return either
        a single object (e.g., a dictionary) or a list of those objects. The
        return value of this function can be iterated over safely.

        N.B. This function would not be helpful for ensuring something is a
        list of lists, for example.

        Args:
            maybe_list (obj): an object which may be a list

        Returns:
            either maybe_list if it is a list, or maybe_list wrapped in a list
    """
    if isinstance(maybe_list, list):
        return maybe_list
    return [maybe_list]