private static boolean resolvesToBoundMethodParameter(@NotNull PsiElement element) {
    if (PyPsiUtils.isMethodContext(element)) {
      final PyFunction function = PsiTreeUtil.getParentOfType(element, PyFunction.class);
      if (function != null) {
        final PsiReference reference = element.getReference();
        if (reference != null) {
          final PsiElement resolved = reference.resolve();
          if (resolved instanceof PyParameter) {
            final PyParameterList parameterList = PsiTreeUtil.getParentOfType(resolved, PyParameterList.class);
            if (parameterList != null) {
              final PyParameter[] parameters = parameterList.getParameters();
              if (parameters.length > 0) {
                if (resolved == parameters[0]) {
                  final PyFunction.Modifier modifier = function.getModifier();
                  if (modifier == null || modifier == PyAstFunction.Modifier.CLASSMETHOD) {
                    return true;
                  }
                }
              }
            }
          }
        }
      }
    }
    return false;
  }
private static boolean resolvesToBoundMethodParameter(@NotNull PsiElement element)