code: def get_keypair_dict():
    
  
    client = get_ec2_client()
    response = client.describe_key_pairs()
    assert is_good_response(response)
  
    result = {}
    ec2 = get_ec2_resource()
    for keypair in response['KeyPairs']:
      keypair_name = keypair.get('KeyName', '')
      if keypair_name in result:
        util.log(f"Warning: Duplicate key {keypair_name}")
      if DUPLICATE_CHECKING:
        assert keypair_name not in result, "Duplicate key " + keypair_name
      result[keypair_name] = ec2.KeyPair(keypair_name)
    return result
docs: Returns dictionary of {keypairname: keypair}