def METHOD_NAME(fobj):
    """
    Return True if the file is empty, i.e. it has a length of 0. Raises an error
    if the file object does not have the seek() or peek() method.
    """
    # Check if our fobj has the peek method. If so, just use that to check
    # one byte ahead.
    try:
        byt = fobj.peek(1)
    except AttributeError:
        # emulate the peek method by saving our current location, reading
        # one byte, then returning to the saved location. It would've been
        # nice to use the os.SEEK_CUR argument to seek(), but that doesn't
        # work on StringIO objects.
        current_location = fobj.tell()
        byt = fobj.read(1)
        fobj.seek(current_location)
    return len(byt) == 0