code: def get_public_key_info(self):
          
          script_parts = virtualchain.btc_script_deserialize(base64.b64decode(self.sig))
          if len(script_parts) < 2:
              return {'error': 'Signature script does not appear to encode any public keys'}
  
          if len(script_parts) == 2:
              # possibly p2pkh
              pubkey = script_parts[1].encode('hex')
              try:
                  pubkey_object = virtualchain.ecdsalib.ecdsa_public_key(pubkey)
              except:
                  return {'error': 'Could not instantiate public key {}'.format(pubkey)}
  
              if virtualchain.address_reencode(pubkey_object.address()) != virtualchain.address_reencode(self.address):
                  return {'error': 'Public key does not match owner address {}'.format(self.address)}
  
              return {'status': True, 'type': 'singlesig', 'public_keys': [pubkey], 'num_sigs': 1}
  
          else:
              # possibly p2sh multisig.
              redeem_script = script_parts[-1]
  
              if virtualchain.address_reencode(virtualchain.btc_make_p2sh_address(redeem_script)) != virtualchain.address_reencode(self.address):
                  return {'error': 'Multisig redeem script does not match owner address {}'.format(self.address)}
  
              m, pubkey_hexes = virtualchain.parse_multisig_redeemscript(redeem_script)
              for pkh in pubkey_hexes:
                  try:
                      virtualchain.ecdsalib.ecdsa_public_key(pkh)
                  except:
                      return {'error': 'Invalid public key string in multisig script'}
  
              return {'status': True, 'type': 'multisig', 'public_keys': pubkey_hexes, 'num_sigs': m}
docs: Analyze the public key information we have in our scriptSig.
          Returns {'status': true, 'type': 'singlesig' | 'multisig', 'public_keys': [...], 'num_sigs': ...} on success
          Returns {'error': ...} on error