def str_to_date(string):
 return (datetime.strptime(string, config.DATE_FORMAT) if string else None)

def str_to_date ( string ) : return ( datetime . strptime ( string , config . DATE_FORMAT ) if string else None )
converts a date string formatted as defined in the configuration to the corresponding datetime value .