from datetime import datetime


def time_from_str(src, date_format):
    """
    Create a datetime object from a time string and a given format
    :param src: time string
    :param date_format: defines how to interpret the time string
    :return: datetime.datetime object
    """
    return datetime.strptime(src, date_format)