def is_wav(origin, filepath, fileobj, *args, **kwargs):
<EOL>if origin == '<STR_LIT>' and fileobj is not None:<EOL><INDENT>loc = fileobj.tell()<EOL>fileobj.seek(<NUM_LIT:0>)<EOL>try:<EOL><INDENT>riff, _, fmt = struct.unpack('<STR_LIT>', fileobj.read(<NUM_LIT:12>))<EOL>if isinstance(riff, bytes):<EOL><INDENT>riff = riff.decode('<STR_LIT:utf-8>')<EOL>fmt = fmt.decode('<STR_LIT:utf-8>')<EOL><DEDENT>return riff == WAV_SIGNATURE[<NUM_LIT:0>] and fmt == WAV_SIGNATURE[<NUM_LIT:1>]<EOL><DEDENT>except (UnicodeDecodeError, struct.error):<EOL><INDENT>return False<EOL><DEDENT>finally:<EOL><INDENT>fileobj.seek(loc)<EOL><DEDENT><DEDENT>elif filepath is not None:<EOL><INDENT>return filepath.endswith(('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>wave.open(args[<NUM_LIT:0>])<EOL><DEDENT>except (wave.Error, AttributeError):<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>
Identify a file as WAV

    See `astropy.io.registry` for details on how this function is used.