from datetime import datetime


def convert_string_to_datetime_obj(x, fmt):
    """Get datetime object from string."""
    if type(x) == str:
        return datetime.strptime(x, fmt)
    else:
        return ''