def hbytes(val):
    """Return pair value and unit."""
    unit = '', 'k', 'M', 'G', 'T', 'P'
    u = 0
    while val > 1000 and u < len(unit):
        u += 1
        val = val / 1024.0
    return val, unit[u]
