docs: def solve(self, **kwargs):
      """
      The kwargs required depend upon the script type.
      hash160_lookup:
          dict-like structure that returns a secret exponent for a hash160
      existing_script:
          existing solution to improve upon (optional)
      sign_value:
          the integer value to sign (derived from the transaction hash)
      signature_type:
          usually SIGHASH_ALL (1)
      """
      # we need a hash160 => secret_exponent lookup
      db = kwargs.get("hash160_lookup")
      if db is None:
          raise SolvingError("missing hash160_lookup parameter")
  
      sign_value = kwargs.get("sign_value")
      signature_type = kwargs.get("signature_type")
  
      secs_solved = set()
      existing_signatures = []
      existing_script = kwargs.get("existing_script")
      if existing_script:
          pc = 0
          opcode, data, pc = tools.get_opcode(existing_script, pc)
          # ignore the first opcode
          while pc < len(existing_script):
              opcode, data, pc = tools.get_opcode(existing_script, pc)
              sig_pair, actual_signature_type = parse_signature_blob(data)
              for sec_key in self.sec_keys:
                  try:
                      public_pair = encoding.sec_to_public_pair(sec_key)
                      sig_pair, signature_type = parse_signature_blob(data)
                      v = ecdsa.verify(ecdsa.generator_secp256k1, public_pair, sign_value, sig_pair)
                      if v:
                          existing_signatures.append(data)
                          secs_solved.add(sec_key)
                          break
                  except encoding.EncodingError:
                      # if public_pair is invalid, we just ignore it
                      pass
  
      for sec_key in self.sec_keys:
          if sec_key in secs_solved:
              continue
          if len(existing_signatures) >= self.n:
              break
          hash160 = encoding.hash160(sec_key)
          result = db.get(hash160)
          if result is None:
              continue
          secret_exponent, public_pair, compressed = result
          binary_signature = self._create_script_signature(secret_exponent, sign_value, signature_type)
          existing_signatures.append(b2h(binary_signature))
      DUMMY_SIGNATURE = "OP_0"
      while len(existing_signatures) < self.n:
          existing_signatures.append(DUMMY_SIGNATURE)
  
      script = "OP_0 %s" % " ".join(s for s in existing_signatures)
      solution = tools.compile(script)
      return solution