def METHOD_NAME(conn, prefix):
    logging.info("clean up keypairs")
    keypairs = list(conn.compute.keypairs())
    for keypair in keypairs:
        keypair_name = keypair.to_dict()["name"]
        if not keypair_name.startswith(prefix):
            continue
        logging.info(keypair_name)
        conn.compute.delete_keypair(keypair)