from datetime import datetime


def _assert_time_format(time):
    """
    Time stamp formatting

    Args:
        time (str): Time stamp from DICOM file.

    Returns:
        time: datetime object
    """
    # Cut off milliseconds
    time = time.split('.')[0]
    time_format = '%H%M%S'
    time = datetime.strptime(time, time_format)

    return time