code: def create_or_get_keypair(self, nova, keypair_name="testkey"):
          
          try:
              _keypair = nova.keypairs.get(keypair_name)
              self.log.debug('Keypair ({}) already exists, '
                             'using it.'.format(keypair_name))
              return _keypair
          except Exception:
              self.log.debug('Keypair ({}) does not exist, '
                             'creating it.'.format(keypair_name))
  
          _keypair = nova.keypairs.create(name=keypair_name)
          return _keypair
docs: Create a new keypair, or return pointer if it already exists.