@Nullable
  private static PyTypeParameterType getTypeParameterTypeFromTypeParameter(@NotNull PsiElement element, @NotNull Context context) {
    if (element instanceof PyTypeParameter typeParameter) {

      PyTypeParameterListOwner typeParameterOwner = PsiTreeUtil.getStubOrPsiParentOfType(element, PyTypeParameterListOwner.class);
      PyQualifiedNameOwner scopeOwner = typeParameterOwner instanceof PyQualifiedNameOwner qualifiedNameOwner ? qualifiedNameOwner : null;

      String boundExpressionText = typeParameter.getBoundExpressionText();
      String name = typeParameter.getName();
      PyTypeParameter.Kind kind = typeParameter.getKind();

      PyExpression boundExpression = boundExpressionText != null
                                     ? PyUtil.createExpressionFromFragment(boundExpressionText, typeParameter.getContainingFile())
                                     : null;

      if (name != null) {
        return switch (kind) {
          case TypeVar -> {
            PyType boundType = boundExpression != null ? getTypeParameterBoundType(boundExpression, context) : null;
            yield new PyTypeVarTypeImpl(name, boundType).withScopeOwner(scopeOwner);
          }
          case ParamSpec -> new PyParamSpecType(name).withScopeOwner(scopeOwner);
          case TypeVarTuple -> new PyTypeVarTupleTypeImpl(name).withScopeOwner(scopeOwner);
        };
      }
    }
    return null;
  }
@Nullable
  private static PyTypeParameterType getTypeParameterTypeFromTypeParameter(@NotNull PsiElement element, @NotNull Context context)