'Attempt to convert sage.all.RR to floats and sage.all.ZZ to ints'

@staticmethod
def encode_as_sage(obj):

    if (not sage_all):
        raise NotEncodable
    if (obj in sage_all.RR):
        return float(obj)
    elif (obj in sage_all.ZZ):
        return int(obj)
    else:
        raise NotEncodable
