Given a :class:`datetime.datetime` object,
    return a formatted time string.

def time2string(tstamp, micro=True):
    """Given a :class:`datetime.datetime` object,
    return a formatted time string."""
    tformat = TIME_FORMAT if micro else TIME_FORMAT[:-len(MICRO)]
    return tstamp.strftime(tformat)