'Converts a Singularity Function expression into its Piecewise form.'

def _eval_rewrite_as_Piecewise(self, *args):

    x = self.args[0]
    a = self.args[1]
    n = sympify(self.args[2])
    if ((n == (-1)) or (n == (-2))):
        return Piecewise((oo, Eq((x - a), 0)), (0, True))
    elif n.is_nonnegative:
        return Piecewise((((x - a) ** n), ((x - a) > 0)), (0, True))
