'Parse a for loop.'

def parse_for(self):

    lineno = self.stream.expect('name:for').lineno
    target = self.parse_assign_target(extra_end_rules=('name:in',))
    self.stream.expect('name:in')
    iter = self.parse_tuple(with_condexpr=False, extra_end_rules=('name:recursive',))
    test = None
    if self.stream.skip_if('name:if'):
        test = self.parse_expression()
    recursive = self.stream.skip_if('name:recursive')
    body = self.parse_statements(('name:endfor', 'name:else'))
    if (next(self.stream).value == 'endfor'):
        else_ = []
    else:
        else_ = self.parse_statements(('name:endfor',), drop_needle=True)
    return nodes.For(target, iter, body, else_, test, recursive, lineno=lineno)
