def process_prefixes(images, prefixes):
    """
    Remove any image which prefix doesn't match what was specified
    in CLI arguments. The result will include any image which
    repository name contains the requested prefix.
    Starts by flattening the list of prefixes received from
    argparse in `[['prefix1'], ['prefix2']]` format.
    """
    flatten = lambda t: [item for sublist in t for item in sublist]
    prefixes = flatten(prefixes)

    for i in reversed(range(len(images))):
        if not any(prefix in images[i]['repository'] for prefix in prefixes):
            del images[i]
    return images