def delete_rax_keypair(args):
 print ("--- Cleaning Key Pairs matching '%s'" % args.match_re)
 for region in pyrax.identity.services.compute.regions:
  cs = pyrax.connect_to_cloudservers(region=region)
  for keypair in cs.keypairs.list():
   if re.search(args.match_re, keypair.name):
    prompt_and_delete(keypair, ('Delete matching %s? [y/n]: ' % keypair), args.assumeyes)

def delete_rax_keypair ( args ) : print ( "--- Cleaning Key Pairs matching '%s'" % args . match_re ) for region in pyrax . identity . services . compute . regions : cs = pyrax . connect_to_cloudservers ( region = region ) for keypair in cs . keypairs . list ( ) : if re . search ( args . match_re , keypair . name ) : prompt_and_delete ( keypair , ( 'Delete matching %s? [y/n]: ' % keypair ) , args . assumeyes )
function for deleting rackspace key pairs .