def encode_time(o):
    """ Encodes a Python datetime.time object as an ECMA-262 compliant
    time string."""
    r = o.isoformat()
    if o.microsecond:
        r = r[:12]
    if r.endswith('+00:00'):
        r = r[:-6] + 'Z'
    return r
Encodes a Python datetime.time object as an ECMA-262 compliant
    time string.