'Parse resource from discovery.
Either URL can be given or dict. Dict has to contain at least
keys \'resource_id\' and \'resource_url\', all the dict keys will be stored
as metadata.
:param res: URL or dict containing all resource info.
:return: parsed_url, resource_id, metadata Returns parsed URL used for
SNMP query, unique identifier of the resource and metadata
of the resource.'

@staticmethod
def _parse_resource(res):

    (parsed_url, resource_id, metadata) = (None, None, None)
    if isinstance(res, dict):
        if (('resource_url' not in res) or ('resource_id' not in res)):
            LOG.error('Passed    resource    dict    must    contain    keys    resource_id    and    resource_url.')
        else:
            metadata = res
            parsed_url = netutils.urlsplit(res['resource_url'])
            resource_id = res['resource_id']
    else:
        metadata = {}
        parsed_url = netutils.urlsplit(res)
        resource_id = res
    return (parsed_url, resource_id, metadata)
