def catalog_ref_split(catalog_ref):

    CatalogRefSplitResult = namedtuple('CatalogRefSplitResult',
                                       'service catalog')
    CatalogInfo = namedtuple('CatalogInfo', 'id loc')

    urlcomps = urlparse(catalog_ref)
    if urlcomps.scheme in ('http', 'https'):
        catalog_id = os.path.split(urlcomps.path)[-1]
        service = catalog_ref[:-len(catalog_id)]
        return CatalogRefSplitResult(service, CatalogInfo(catalog_id, None))

    elif urlcomps.scheme in ('file', ''):
        return CatalogRefSplitResult(catalog_ref, CatalogInfo(None, '.'))


## TODO: fix cloning between this and zinc.services.simple
dataset/ETHPy150Open mindsnacks/Zinc/src/zinc/client.py/catalog_ref_split/original