import fsspec


def _path_to_mapper(path, storage_options):
    """Convert path to mapper if necessary."""

    protocol = fsspec.core.split_protocol(path)[0]

    if protocol in {'http', 'https'} or protocol is None:
        return path

    else:
        return fsspec.get_mapper(path, **storage_options)