def get_name(node):
  """Get the name of a variable.

  Args:
    node: A `Name`, `Subscript` or `Attribute` node.

  Returns:
    The name of the variable e.g. `'x'` for `x`, `x.i` and `x[i]`.
  """
  if isinstance(node, gast.Name):
    return node.id
  elif isinstance(node, (gast.Subscript, gast.Attribute)):
    return get_name(node.value)
  else:
    raise TypeError
Get the name of a variable.

  Args:
    node: A `Name`, `Subscript` or `Attribute` node.

  Returns:
    The name of the variable e.g. `'x'` for `x`, `x.i` and `x[i]`.