def METHOD_NAME(loc: str) -> Optional[BaseFormat]:
    """
    get a Format object appropriate for the file at loc.
    if no suitable object can be found, None is returned.
    :param loc: The location to read from as a Gio URI
        (from Track.get_loc_for_io())
    """
    loc = Gio.File.new_for_uri(loc).get_path()
    if not loc:
        return None
    ext = os.path.splitext(loc)[1]
    ext = ext[1:]  # remove the pesky .
    ext = ext.lower()
    try:
        formatclass = formats[ext]
    except KeyError:
        return None  # not supported
    if formatclass is None:
        formatclass = DummyFormat
    # Some file types can be more than one format
    # So check each possible format
    if type(formatclass) is list:
        for klass in formatclass:
            try:
                return klass(loc)
            except:
                continue
        return None
    try:
        return formatclass(loc)
    except NotReadable:
        return None