<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_unique_constraints(self, instance):
 """Return SQL filter for filtering by fields in ``unique_with`` attribute. Filter is returned as tuple of two elements where first one is placeholder which is safe to insert into SQL query and second one may include potentially dangerous values and must be passed to SQL query in ``params`` attribute to make sure it is properly escaped. """

        constraints_expression = []
        constraints_values = {}
        for field_name in self.unique_with:
            if constants.LOOKUP_SEP in field_name:
                raise NotImplementedError(
                    '`unique_with` constraint does not support lookups by related models.'
                )

            field = instance._meta.get_field(field_name)  # pylint: disable=protected-access
            field_value = getattr(instance, field_name)

            # Convert value to the database representation.
            field_db_value = field.get_prep_value(field_value)

            constraint_key = 'unique_' + field_name
            constraints_expression.append("{} = %({})s".format(
                connection.ops.quote_name(field.column),
                constraint_key
            ))
            constraints_values[constraint_key] = field_db_value

        if not constraints_expression:
            return '', []

        constraints_expression = 'AND ' + ' AND '.join(constraints_expression)
        return constraints_expression, constraints_values