def detect_format(fn, format_bytes=<NUM_LIT:50>, verbose=False, *args, **kwargs):
assert format_bytes > <NUM_LIT:0><EOL>assert verbose in [True, False]<EOL>with open(fn, '<STR_LIT:rb>') as f:<EOL><INDENT>rough_header = f.read(format_bytes)<EOL>if re.match(r'<STR_LIT>', rough_header):<EOL><INDENT>file_format = "<STR_LIT>"<EOL><DEDENT>elif re.match(r'<STR_LIT>', rough_header):<EOL><INDENT>file_format = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>file_format = "<STR_LIT>"<EOL><DEDENT><DEDENT>if verbose:<EOL><INDENT>print("<STR_LIT>".format(file_format), file=sys.stderr)<EOL><DEDENT>return file_format<EOL>
Detect Amira file format (AmiraMesh or HyperSurface)

    :param str fn: file name
    :param int format_bytes: number of bytes in which to search for the format [default: 50]
    :param bool verbose: verbose (default) or not
    :return str file_format: either ``AmiraMesh`` or ``HyperSurface``