'Returns the DiracDelta expression written in the form of Singularity Functions.'

def _eval_rewrite_as_SingularityFunction(self, *args):

    from sympy.solvers import solve
    from sympy.functions import SingularityFunction
    if (self == DiracDelta(0)):
        return SingularityFunction(0, 0, (-1))
    if (self == DiracDelta(0, 1)):
        return SingularityFunction(0, 0, (-2))
    free = self.free_symbols
    if (len(free) == 1):
        x = free.pop()
        if (len(args) == 1):
            return SingularityFunction(x, solve(args[0], x)[0], (-1))
        return SingularityFunction(x, solve(args[0], x)[0], ((- args[1]) - 1))
    else:
        raise TypeError(filldedent("\n                                                                rewrite(SingularityFunction)    doesn't    support    arguments    with    more    that    1    variable."))
