import six


def _func_type(func):
    """ returns if callable is a function, method or a classmethod """
    argnames = six.get_function_code(func).co_varnames[:six.get_function_code(func).co_argcount]
    if len(argnames) > 0:
        if argnames[0] == 'self':
            return 'method'
        if argnames[0] == 'cls':
            return 'classmethod'
    return 'function'