@Nullable
  private static Ref<PyType> getGeneratorReturnType(@Nullable PyType type) {
    if (type instanceof PyCollectionType) {
      if (PyNames.AWAITABLE.equals(((PyClassType)type).getPyClass().getName())) {
        return Ref.create(((PyCollectionType)type).getIteratedItemType());
      }
      else {
        return PyTypingTypeProvider.coroutineOrGeneratorElementType(type);
      }
    }
    else if (type instanceof PyUnionType) {
      return PyTypeUtil
        .toStream(type)
        .map(PyPrefixExpressionImpl::getGeneratorReturnType)
        .collect(PyTypeUtil.toUnionFromRef());
    }
    return null;
  }
@Nullable
  private static Ref<PyType> getGeneratorReturnType(@Nullable PyType type)