:param str_format:
    :param timestamp: str of the timestamp
    :return:          datetime

def str_to_datetime(timestamp, str_format='%Y-%m-%d_%H:%M:%S.fff'):
    """
    :param str_format:
    :param timestamp: str of the timestamp
    :return:          datetime
    """
    date_time = datetime.strptime(timestamp.split('.')[0],
                                  str_format.split('.')[0])
    if '.' in timestamp:
        date_time += timedelta(seconds=eval('0.%s' % timestamp.split('.')[1]))
    if DEFAULT_TIMEZONE_AWARE:
        date_time = date_time.replace(
            tzinfo=psycopg2.tz.FixedOffsetTimezone(
                offset=DEFAULT_TIMEZONE * 60, name=None))
    return date_time