'Get second token in line
>>> docwriter = ApiDocWriter(\'sphinx\')
>>> docwriter._get_object_name("  def func():  ")
\'func\'
>>> docwriter._get_object_name("  class Klass(object):  ")
\'Klass\'
>>> docwriter._get_object_name("  class Klass:  ")
\'Klass\''

def _get_object_name(self, line):

    if line.startswith('cdef'):
        line = line.split(None, 1)[1]
    name = line.split()[1].split('(')[0].strip()
    return name.rstrip(':')
