code: def append_if_local_or_in_imports(self, definition):
          
          if isinstance(definition, LocalModuleDefinition):
              self.definitions.append(definition)
          elif self.import_names == ["*"]:
              self.definitions.append(definition)
          elif self.import_names and definition.name in self.import_names:
              self.definitions.append(definition)
          elif (self.import_alias_mapping and definition.name in
                self.import_alias_mapping.values()):
              self.definitions.append(definition)
  
          if definition.parent_module_name:
              self.definitions.append(definition)
  
          if definition.node not in project_definitions:
              project_definitions[definition.node] = definition
docs: Add definition to list.
  
          Handles local definitions and adds to project_definitions.