def parse_file_to_uri(url):
    """If this is a file path, return a Path object, otherwise, return None"""
    import pathlib
    from urllib.parse import urlparse, urlunparse
    import re
    url = str(url)
    p = urlparse(url)
    if p.scheme == 'file':
        return url
    if p.fragment:
        url = re.sub('\\#[^#]*', '', url)
    try:
        if re.match('^[a-zA-Z]:', url):
            uri = pathlib.PureWindowsPath(url.replace('\\', '/')).as_uri()
        elif url.startswith('//') or url.startswith('\\\\'):
            uri = pathlib.PureWindowsPath(url.replace('\\', '/')).as_uri()
        elif not p.scheme:
            uri = pathlib.PurePath(url.replace('\\', '/')).as_uri()
        else:
            uri = None
    except ValueError as e:
        uri = 'file:' + p.path
    if uri:
        if p.fragment:
            uri = str(uri) + ('#' + p.fragment)
        return uri
    else:
        return None
