def _flatten_list(nested_list):
    """
    Given a nested list, returns flat list of all its elements

    :param nested_list: nested list
    :return: flat list
    """
    if not isinstance(nested_list, list):
        return [nested_list]

    res = []
    for sub_list in nested_list:
        res += _flatten_list(sub_list)

    return res