def MakeOffset(x, sign=True):
    """Make integer x into an IDA-styled offset string

    >>> MakeOffset(0)
    0
    >>> MakeOffset(0xd0)
    0D0h
    >>> MakeOffset(0x1234)
    1234h
    """
    if sign and x == 0:
        return ""

    hexstr = "%X" % x
    if hexstr[0] in ('A','B','C','D','E','F'):
        hexstr = '0' + hexstr
    if x > 9:
        hexstr += 'h'

    if sign and x >= 0:
        return "+%s" % hexstr
    return hexstr