Return modified variable name.

    >>> import gast as ast
    >>> ref = ast.Subscript(
    ...     value=ast.Subscript(
    ...         value=ast.Name(id='a', ctx=ast.Load(), annotation=None),
    ...         slice=ast.Index(value=ast.Name('i', ast.Load(), None)),
    ...         ctx=ast.Load()),
    ...     slice=ast.Index(value=ast.Name(id='j',
    ...                                    ctx=ast.Load(), annotation=None)),
    ...     ctx=ast.Load())
    >>> ast.dump(get_variable(ref))
    "Name(id='a', ctx=Load(), annotation=None)"

def get_variable(assignable):
    """
    Return modified variable name.

    >>> import gast as ast
    >>> ref = ast.Subscript(
    ...     value=ast.Subscript(
    ...         value=ast.Name(id='a', ctx=ast.Load(), annotation=None),
    ...         slice=ast.Index(value=ast.Name('i', ast.Load(), None)),
    ...         ctx=ast.Load()),
    ...     slice=ast.Index(value=ast.Name(id='j',
    ...                                    ctx=ast.Load(), annotation=None)),
    ...     ctx=ast.Load())
    >>> ast.dump(get_variable(ref))
    "Name(id='a', ctx=Load(), annotation=None)"
    """
    msg = "Only name and subscript can be assigned."
    assert isinstance(assignable, (ast.Name, ast.Subscript)), msg
    while isinstance(assignable, ast.Subscript) or isattr(assignable):
        if isattr(assignable):
            assignable = assignable.args[0]
        else:
            assignable = assignable.value
    return assignable