def METHOD_NAME(fmt, fp):
    """
    Reads data from ``fp`` according to ``fmt``.
    """
    fmt = str(">" + fmt)
    fmt_size = struct.calcsize(fmt)
    data = fp.read(fmt_size)
    try:
        assert len(data
                   ) == fmt_size, 'read=%d, expected=%d' % (len(data), fmt_size)
    except AssertionError:
        fp.seek(-len(data), 1)
        raise
    return struct.unpack(fmt, data)