from datetime import datetime


def datetime_to_string(datetime_obj):
    """ Converts to isoformat after dropping microseconds
    """
    if not isinstance(datetime_obj, datetime):
        msg = 'expected to be passed a datetime.datetime, was passed {}'.format(type(datetime_obj))
        raise ValueError(msg)
    stripped = datetime_obj.replace(microsecond=0)
    return stripped.isoformat()