<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def overrules(self, other):
 """ Detects if the other index is a non-unique, non primary index that can be overwritten by this one. :param other: The other index :type other: Index :rtype: bool """

        if other.is_primary():
            return False
        elif self.is_simple_index() and other.is_unique():
            return False

        same_columns = self.spans_columns(other.get_columns())
        if (
            same_columns
            and (self.is_primary() or self.is_unique())
            and self.same_partial_index(other)
        ):
            return True

        return False