code: def add_surface(self, name, surface):
          
          assert surface is not None
  
          if hasattr(self.module, name):
              raise ThriftCompilerError(
                  'Cannot define "%s". The name has already been used.' % name
              )
  
          setattr(self.module, name, surface)
docs: Adds a top-level attribute with the given name to the module.