code: def insert(self, resource, value):
          
  
          # Split res into components and bindings
          parts = resource_parts_re.split(resource)
  
          # If the last part is empty, this is an invalid resource
          # which we simply ignore
          if parts[-1] == '':
              return
  
          self.lock.acquire()
  
          db = self.db
          for i in range(1, len(parts), 2):
  
              # Create a new mapping/value group
              if parts[i - 1] not in db:
                  db[parts[i - 1]] = ({}, {})
  
              # Use second mapping if a loose binding, first otherwise
              if '*' in parts[i]:
                  db = db[parts[i - 1]][1]
              else:
                  db = db[parts[i - 1]][0]
  
          # Insert value into the derived db
          if parts[-1] in db:
              db[parts[-1]] = db[parts[-1]][:2] + (value, )
          else:
              db[parts[-1]] = ({}, {}, value)
  
          self.lock.release()
docs: insert(resource, value)
  
          Insert a resource entry into the database.  RESOURCE is a
          string and VALUE can be any Python value.