code: def ExtractCredentialsFromPathSpec(self, path_spec):
      
      credentials = manager.CredentialsManager.GetCredentials(path_spec)
      for identifier in credentials.CREDENTIALS:
        value = getattr(path_spec, identifier, None)
        if value is None:
          continue
  
        self.SetCredential(path_spec, identifier, value)
docs: Extracts credentials from a path specification.
  
      Args:
        path_spec (PathSpec): path specification to extract credentials from.