import struct


def unpack(fmt, data):
    """
    a more ergonnomic struct.unpack,If data is longer than the fmt spec it copes
    remaining data returned as last data element

    @param fmt: format string as per L{struct.unpack}
    @type fmt: L{str}
    @param data: data to be unpacked, optionally more
    @type data: L{bytes}

    @rtype: L{tuple}
    """
    sz = struct.calcsize(fmt)
    ret = struct.unpack(fmt, data[:sz])
    ret = list(ret)
    ret.append(data[sz:])
    return tuple(ret)