<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def lookup(self, opaque_ref):
 """ Lookups the object that was used for creating the reference. """

        opaque_ref_value = self._get_reference_value(opaque_ref)
        # check local refs
        if opaque_ref_value in self.local_refs:
            return self.local_refs[opaque_ref_value]
        # check global refs
        if opaque_ref_value in self.global_refs:
            return self.global_refs[opaque_ref_value]
        raise KeyError("Unknown JNI reference %d. Local references: %s Global references: %s"
                       % (opaque_ref_value, self.local_refs, self.global_refs))