Remove source information from path when using chaching

    Returns None if path is not str

    Parameters
    ----------
    path : str
        Path to data optionally containing format_strings
    metadata : dict, optional
        Extra arguments to the class, contains any cache information

    Returns
    -------
    pattern : str
        Pattern style path stripped of everything to the left of cache regex.

def path_to_pattern(path, metadata=None):
    """
    Remove source information from path when using chaching

    Returns None if path is not str

    Parameters
    ----------
    path : str
        Path to data optionally containing format_strings
    metadata : dict, optional
        Extra arguments to the class, contains any cache information

    Returns
    -------
    pattern : str
        Pattern style path stripped of everything to the left of cache regex.
    """
    if not isinstance(path, str):
        return

    pattern = path
    if metadata:
        cache = metadata.get('cache')
        if cache:
            regex = next(c.get('regex') for c in cache if c.get('argkey') == 'urlpath')
            pattern = pattern.split(regex)[-1]
    return pattern