docs: def key_present(name, save_private=None, upload_public=None, region=None,
                  key=None, keyid=None, profile=None):
      '''
      Ensure key pair is present.
      '''
      ret = {'name': name,
             'result': True,
             'comment': '',
             'changes': {}
             }
      exists = __salt__['boto_ec2.get_key'](name, region, key, keyid, profile)
      log.debug('exists is %s', exists)
      if upload_public is not None and 'salt://' in upload_public:
          try:
              upload_public = __salt__['cp.get_file_str'](upload_public)
          except IOError as e:
              log.debug(e)
              ret['comment'] = 'File {0} not found.'.format(upload_public)
              ret['result'] = False
              return ret
      if not exists:
          if __opts__['test']:
              ret['comment'] = 'The key {0} is set to be created.'.format(name)
              ret['result'] = None
              return ret
          if save_private and not upload_public:
              created = __salt__['boto_ec2.create_key'](
                  name, save_private, region, key, keyid, profile
              )
              if created:
                  ret['result'] = True
                  ret['comment'] = 'The key {0} is created.'.format(name)
                  ret['changes']['new'] = created
              else:
                  ret['result'] = False
                  ret['comment'] = 'Could not create key {0} '.format(name)
          elif not save_private and upload_public:
              imported = __salt__['boto_ec2.import_key'](name, upload_public,
                                                         region, key, keyid,
                                                         profile)
              if imported:
                  ret['result'] = True
                  ret['comment'] = 'The key {0} is created.'.format(name)
                  ret['changes']['old'] = None
                  ret['changes']['new'] = imported
              else:
                  ret['result'] = False
                  ret['comment'] = 'Could not create key {0} '.format(name)
          else:
              ret['result'] = False
              ret['comment'] = 'You can either upload or download a private key '
      else:
          ret['result'] = True
          ret['comment'] = 'The key name {0} already exists'.format(name)
      return ret