def flatten(obj):
    """
    Flattens an object into a list of base values.
    """
    if isinstance(obj, list) or isinstance(obj, dict):
        l = []
        to_flatten = obj if isinstance(obj, list) else obj.values()
        for sublist in map(flatten, to_flatten):
            if isinstance(sublist, list):
                l += flatten(sublist)
            else:
                l.append(sublist)
        return l
    return obj