from datetime import datetime


def datify(in_string):
    """
    Turn a string into a datetime object, catching errors
    """
    out_data = in_string
    if in_string:
        try:
            out_data = datetime.strptime(in_string, "%d-%m-%Y")
        except ValueError as err:
            print("Invalid date ({}): {}".format(in_string, err))
        except TypeError as err:
            print("Invalid date ({}): {}".format(in_string, err))
    return out_data