def filter_deleted_items(items, flag):
    """Filter deleted items

    :param items: target
    :param flag: deleted flag name, always True means deleted
    :return: list does not contain deleted items
    """

    # just return if parameter is not a list
    if not isinstance(items, list):
        return items

    result = filter(lambda x: not x[flag], items)
    return [x for x in result]