def determine_format(data, extension=None):
if isinstance(data, (os.PathLike, str)):<EOL><INDENT>data = open(data, '<STR_LIT:rb>')<EOL><DEDENT>data_reader = DataReader(data)<EOL>data_reader.seek(<NUM_LIT:0>, os.SEEK_SET)<EOL>d = data_reader.read(<NUM_LIT:4>)<EOL>if d.startswith((b'<STR_LIT>', b'<STR_LIT>')):  <EOL><INDENT>if extension is None or extension.endswith('<STR_LIT>'):<EOL><INDENT>return MP3<EOL><DEDENT><DEDENT>if d.startswith((b'<STR_LIT>', b'<STR_LIT>')):<EOL><INDENT>if extension is None or extension.endswith('<STR_LIT>'):<EOL><INDENT>return FLAC<EOL><DEDENT><DEDENT>if d.startswith(b'<STR_LIT>'):<EOL><INDENT>if extension is None or extension.endswith('<STR_LIT>'):<EOL><INDENT>return WAV<EOL><DEDENT><DEDENT>return None<EOL>
Determine the format of an audio file.

    Parameters:
            data (bytes-like object, str, os.PathLike, or file-like object):
                    A bytes-like object, filepath, path-like object
                    or file-like object of an audio file.
            extension (str): The file extension of the file.
                    Used as a tie-breaker for formats that can
                    be used in multiple containers (e.g. ID3).