'Get signature from inspect reply content'

def get_signature(self, content):

    data = content.get('data', {})
    text = data.get('text/plain', '')
    if text:
        text = ANSI_OR_SPECIAL_PATTERN.sub('', text)
        self._control.current_prompt_pos = self._prompt_pos
        line = self._control.get_current_line_to_cursor()
        name = line[:(-1)].split('(')[(-1)]
        name = name.split('.')[(-1)]
        try:
            name = self.clean_invalid_var_chars(name).split('_')[(-1)]
        except:
            pass
        argspec = getargspecfromtext(text)
        if argspec:
            signature = (name + argspec)
        else:
            signature = getsignaturefromtext(text, name)
        return signature
    else:
        return ''
