'Returns the Heaviside 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 == Heaviside(0)):
        return SingularityFunction(0, 0, 0)
    free = self.free_symbols
    if (len(free) == 1):
        x = free.pop()
        return SingularityFunction(x, solve(args, x)[0], 0)
    else:
        raise TypeError(filldedent("\n                                                                rewrite(SingularityFunction)    doesn't    support    arguments    with    more    that    1    variable."))
