def _var_docstrings(tree, module, cls=None, init=False):
vs = {}<EOL>children = list(ast.iter_child_nodes(tree))<EOL>for i, child in enumerate(children):<EOL><INDENT>if isinstance(child, ast.Assign) and len(child.targets) == <NUM_LIT:1>:<EOL><INDENT>if not init and isinstance(child.targets[<NUM_LIT:0>], ast.Name):<EOL><INDENT>name = child.targets[<NUM_LIT:0>].id<EOL><DEDENT>elif (isinstance(child.targets[<NUM_LIT:0>], ast.Attribute)<EOL>and isinstance(child.targets[<NUM_LIT:0>].value, ast.Name)<EOL>and child.targets[<NUM_LIT:0>].value.id == '<STR_LIT>'):<EOL><INDENT>name = child.targets[<NUM_LIT:0>].attr<EOL><DEDENT>else:<EOL><INDENT>continue<EOL><DEDENT>if not _is_exported(name)and name not in getattr(module, '<STR_LIT>', []):<EOL><INDENT>continue<EOL><DEDENT>docstring = '<STR_LIT>'<EOL>if (i+<NUM_LIT:1> < len(children)<EOL>and isinstance(children[i+<NUM_LIT:1>], ast.Expr)<EOL>and isinstance(children[i+<NUM_LIT:1>].value, ast.Str)):<EOL><INDENT>docstring = children[i+<NUM_LIT:1>].value.s<EOL><DEDENT>vs[name] = Variable(name, module, docstring, cls=cls)<EOL><DEDENT><DEDENT>return vs<EOL>
Extracts variable docstrings given `tree` as the abstract syntax,
`module` as a `pydoc.Module` containing `tree` and an option `cls`
as a `pydoc.Class` corresponding to the tree. In particular, `cls`
should be specified when extracting docstrings from a class or an
`__init__` method. Finally, `init` should be `True` when searching
the AST of an `__init__` method so that `_var_docstrings` will only
accept variables starting with `self.` as instance variables.

A dictionary mapping variable name to a `pydoc.Variable` object is
returned.