@staticmethod
def wildcard_match(fname, ftype, wildcard):
    """Return True if file matches a DOS wildcard."""
    if isinstance(wildcard, str):
        wildcard = wildcard.encode()
    if b'=' in wildcard:
        if wildcard[-1] == ord('='):
            raise ValueError('Invalid wildcard, ' + str(wildcard))
        wildcard, wftype = wildcard.split(b'=', 1)
        if ord(ftype[0]) != wftype[0]:
            return False
    for w, f in zip(wildcard, fname):
        if w == ord('?'):
            continue
        if w == ord('*'):
            return True
        if w != f:
            return False
    if len(fname) + 1 == len(wildcard) and wildcard.endswith(b'*'):
        return True
    return len(fname) == len(wildcard)
