'A description of the :class:`.Definition` object, which is heavily used
in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
Example:
>>> from jedi import Script
>>> source = \'\'\'
... def f():
...     pass
... class C:
...     pass
... variable = f if random.choice([0,1]) else C\'\'\'
>>> script = Script(source, column=3)  # line is maximum by default
>>> defs = script.goto_definitions()
>>> defs = sorted(defs, key=lambda d: d.line)
>>> defs
[<Definition def f>, <Definition class C>]
>>> str(defs[0].description)  # strip literals in python2
\'def f\'
>>> str(defs[1].description)
\'class C\''

@property
def description(self):

    typ = self.type
    tree_name = self._name.tree_name
    if ((typ in ('function', 'class', 'module', 'instance')) or (tree_name is None)):
        if (typ == 'function'):
            typ = 'def'
        return ((typ + '    ') + u(self._name.string_name))
    elif (typ == 'param'):
        return ((typ + '    ') + tree_name.get_definition().get_description())
    definition = tree_name.get_definition()
    txt = definition.get_code(include_prefix=False)
    txt = re.sub('#[^\n]+\n', '    ', txt)
    txt = re.sub('\\s+', '    ', txt).strip()
    return txt
