<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dttm_sql_literal(self, dttm, is_epoch_in_utc):
 """Convert datetime object to a SQL expression string If database_expression is empty, the internal dttm will be parsed as the string with the pattern that the user inputted (python_date_format) If database_expression is not empty, the internal dttm will be parsed as the sql sentence for the database to convert """

        tf = self.python_date_format
        if self.database_expression:
            return self.database_expression.format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
        elif tf:
            if is_epoch_in_utc:
                seconds_since_epoch = dttm.timestamp()
            else:
                seconds_since_epoch = (dttm - datetime(1970, 1, 1)).total_seconds()
            seconds_since_epoch = int(seconds_since_epoch)
            if tf == 'epoch_s':
                return str(seconds_since_epoch)
            elif tf == 'epoch_ms':
                return str(seconds_since_epoch * 1000)
            return "'{}'".format(dttm.strftime(tf))
        else:
            s = self.table.database.db_engine_spec.convert_dttm(
                self.type or '', dttm)
            return s or "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S.%f'))