Process filters by non-API fields

    There are cases where it is useful to provide a filter field
    which does not exist in a resource in a backend service.
    For example, nova server list provides 'image' field with image ID
    but 'image name' is more useful for GUI users.
    This function replaces fake fields into corresponding real fields.

    The format of non_api_filter_info is a tuple/list of
    (fake_field, real_field, resources).

    This returns True if further lookup is required.
    It returns False if there are no matching resources,
    for example, if no corresponding real field exists.

def process_non_api_filters(search_opts, non_api_filter_info):
    """Process filters by non-API fields

    There are cases where it is useful to provide a filter field
    which does not exist in a resource in a backend service.
    For example, nova server list provides 'image' field with image ID
    but 'image name' is more useful for GUI users.
    This function replaces fake fields into corresponding real fields.

    The format of non_api_filter_info is a tuple/list of
    (fake_field, real_field, resources).

    This returns True if further lookup is required.
    It returns False if there are no matching resources,
    for example, if no corresponding real field exists.
    """
    for fake_field, real_field, resources in non_api_filter_info:
        if not _swap_filter(resources, search_opts, fake_field, real_field):
            return False
    return True