<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_apis(reg, features=None, extensions=None, api=None, profile=None, support=None):
 """Groups Types, Enums, Commands with their respective Features, Extensions Similar to :py:func:`import_registry`, but generates a new Registry object for every feature or extension. :param Registry reg: Input registry :param features: Feature names to import, or None to import all. :type features: Iterable of strs :param extensions: Extension names to import, or None to import all. :type extensions: Iterable of strs :param str profile: Import features which belong in `profile`, or None to import all. :param str api: Import features which belong in `api`, or None to import all. :param str support: Import extensions which belong in this extension support string, or None to import all. :returns: list of :py:class:`Registry` objects """

    features = (reg.get_features(api) if features is None
                else [reg.features[x] for x in features])
    if extensions is None:
        extensions = sorted(reg.get_extensions(support),
                            key=extension_sort_key)
    else:
        extensions = [reg.extensions[x] for x in extensions]
    output_symbols = set()

    def filter_symbol(type, name):
        k = (type, name)
        if k in output_symbols:
            return False
        else:
            output_symbols.add(k)
            return True

    out_apis = []
    for x in features:
        out = Registry(x.name)
        import_feature(out, reg, x.name, api, profile, filter_symbol)
        out_apis.append(out)
    for x in extensions:
        out = Registry(x.name)
        import_extension(out, reg, x.name, api, profile, filter_symbol)
        out_apis.append(out)
    return out_apis