def datetime_to_str(time):
    """convert python datetime object to a 
    {hour}:{min}:{second}:{millisecond} string format

    """
    return '{hour}:{min}:{second}:{millisecond}'.format(
        hour=time.hour,
        min=time.minute, 
        second=time.second,
        millisecond=str(int(round(time.microsecond / 1000.0))),
        )