<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get(self, r):
 """ Returns precomputed value of the given expression """

        if r is None:
            return None

        if r.lower() == '(sp)' and self.stack:
            return self.stack[-1]

        if r[:1] == '(':
            return self.mem[r[1:-1]]

        r = r.lower()
        if is_number(r):
            return str(valnum(r))

        if not is_register(r):
            return None

        return self.regs[r]