def second2human(x, ignore_msec=True):
    """
    given seconds return human-readable string

    >>> second2human(10)
    '10s'
    >>> second2human(100)
    '1m 40s'
    >>> second2human(10000)
    '2h 46m 40s'
    >>> second2human(1.234, ignore_msec=False)
    '1s 234ms'
    """
    s_hour = x // 3600
    s_min = x // 60 % 60
    s_sec = int(x) % 60
    ret = ""
    if s_hour:
        ret += "%dh " % s_hour
    if s_hour or s_min:
        ret += "%dm " % s_min
    ret += "%ds" % s_sec
    if not ignore_msec:
        s_msec = int(x * 1000) % 1000
        ret += " %dms" % s_msec
    return ret