code: def import_keypair(kwargs=None, call=None):
      '''
      Upload public key to cloud provider.
      Similar to EC2 import_keypair.
  
      .. versionadded:: 2016.11.0
  
      kwargs
          file(mandatory): public key file-name
          keyname(mandatory): public key name in the provider
      '''
      with salt.utils.files.fopen(kwargs['file'], 'r') as public_key_filename:
          public_key_content = salt.utils.stringutils.to_unicode(public_key_filename.read())
  
      digitalocean_kwargs = {
          'name': kwargs['keyname'],
          'public_key': public_key_content
      }
  
      created_result = create_key(digitalocean_kwargs, call=call)
      return created_resulf import_keypair(kwargs=None, call=None):
      '''
      Upload public key to cloud provider.
      Similar to EC2 import_keypair.
  
      .. versionadded:: 2016.11.0
  
      kwargs
          file(mandatory): public key file-name
          keyname(mandatory): public key name in the provider
      '''
      with salt.utils.files.fopen(kwargs['file'], 'r') as public_key_filename:
          public_key_content = salt.utils.stringutils.to_unicode(public_key_filename.read())
  
      digitalocean_kwargs = {
          'name': kwargs['keyname'],
          'public_key': public_key_content
      }
  
      created_result = create_key(digitalocean_kwargs, call=call)
      return created_result
docs: Upload public key to cloud provider.
      Similar to EC2 import_keypair.
  
      .. versionadded:: 2016.11.0
  
      kwargs
          file(mandatory): public key file-name
          keyname(mandatory): public key name in the provider