<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _infer_decorator_callchain(node):
 """Detect decorator call chaining and see if the end result is a static or a classmethod. """

    if not isinstance(node, FunctionDef):
        return None
    if not node.parent:
        return None
    try:
        result = next(node.infer_call_result(node.parent))
    except exceptions.InferenceError:
        return None
    if isinstance(result, bases.Instance):
        result = result._proxied
    if isinstance(result, ClassDef):
        if result.is_subtype_of("%s.classmethod" % BUILTINS):
            return "classmethod"
        if result.is_subtype_of("%s.staticmethod" % BUILTINS):
            return "staticmethod"
    return None