<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_context(self, expr, ctx):
 """Set the context of an expression to Store or Del if possible."""

        t = type(expr)
        try:
            # TODO: check if Starred is ok
            if t in (ast.Attribute, ast.Name):
                if type(ctx) == ast.Store():
                    mis.check_forbidden_name(getattr (expr, expression_name_map[t]), expr)
            elif t in (ast.Subscript, ast.Starred):
                pass
            elif t in (ast.List, ast.Tuple):
                for elt in expr.elts:
                    self.set_context(elt, ctx)
            expr.ctx = ctx
        except misc.ForbiddenNameAssignment as e:
            self.error_ast("cannot assign to %s" % (e.name,), e.node)