<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _merge_apis(collector):
 """ Quite often, an API is defined both in Implicit and Explicit API definitions. In such cases, Implicit API definition wins because that conveys clear intent that the API is backed by a function. This method will merge two such list of Apis with the right order of precedence. If a Path+Method combination is defined in both the places, only one wins. Parameters collector : ApiCollector Collector object that holds all the APIs specified in the template Returns ------- list of samcli.commands.local.lib.provider.Api List of APIs obtained by combining both the input lists. """


        implicit_apis = []
        explicit_apis = []

        # Store implicit and explicit APIs separately in order to merge them later in the correct order
        # Implicit APIs are defined on a resource with logicalID ServerlessRestApi
        for logical_id, apis in collector:
            if logical_id == SamApiProvider._IMPLICIT_API_RESOURCE_ID:
                implicit_apis.extend(apis)
            else:
                explicit_apis.extend(apis)

        # We will use "path+method" combination as key to this dictionary and store the Api config for this combination.
        # If an path+method combo already exists, then overwrite it if and only if this is an implicit API
        all_apis = {}

        # By adding implicit APIs to the end of the list, they will be iterated last. If a configuration was already
        # written by explicit API, it will be overriden by implicit API, just by virtue of order of iteration.
        all_configs = explicit_apis + implicit_apis

        for config in all_configs:
            # Normalize the methods before de-duping to allow an ANY method in implicit API to override a regular HTTP
            # method on explicit API.
            for normalized_method in SamApiProvider._normalize_http_methods(config.method):
                key = config.path + normalized_method
                all_apis[key] = config

        result = set(all_apis.values())  # Assign to a set() to de-dupe
        LOG.debug("Removed duplicates from '%d' Explicit APIs and '%d' Implicit APIs to produce '%d' APIs",
                  len(explicit_apis), len(implicit_apis), len(result))

        return list(result)