We currently ignore nested classes, i.e.:
          class X:
              class Y:
                  [ALL OF THIS IS IGNORED]

def to_string(self) -> str:
        """We currently ignore nested classes, i.e.:
          class X:
              class Y:
                  [ALL OF THIS IS IGNORED]
        """
        classes = defaultdict(list)
        typing_imports = set()
        contents = ""

        # import necessary modules from typing
        for stub in self._stubs:
            typing_imports.update(stub.get_typing_imports())
        alphabetical_imports = sorted(list(typing_imports))
        if alphabetical_imports:
            contents += "from typing import {}\n\n".format(
                ", ".join(str(type_import) for type_import in alphabetical_imports)
            )

        for stub in self._fields:
            parent = _relativize_access(stub.parent, stub.path)
            # Ignore nested classes
            if len(parent) == 1:
                classes[parent[0]].append(stub)
            else:
                contents += stub.to_string() + "\n"

        for stub in self._methods:
            parent = _relativize_access(stub.parent, stub.path)
            # Ignore nested classes
            if len(parent) == 1:
                classes[parent[0]].append(stub)

        for stub in self._functions:
            contents += stub.to_string() + "\n"

        for parent, stubs in classes.items():
            contents += "\nclass {}:\n".format(parent)
            for stub in stubs:
                contents += "    {}\n".format(stub.to_string().replace("\n", "\n    "))
        return contents