<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_target(self, target, ctx=None):
 """Set target. :param target: new target to use. :param target ctx: target ctx if target is an class/instance attribute. """


        if target is not None:
            # check if target is already intercepted
            if is_intercepted(target):
                # set self interception last target reference
                self._interception = target
                # and targets, ctx
                self.target, self.ctx = get_intercepted(target)
            else:
                # if not, update target reference with new interception
                self.apply_pointcut(target, ctx=ctx)