'Import a new public key from string.
:param name: Key pair name.
:type name: ``str``
:param key_material: Public key material.
:type key_material: ``str``
:param ex_location: Location where to store the key
:type ex_location: :class:`NodeLocation`
:return: Imported key pair object.
:rtype: :class:`KeyPair`'

def import_key_pair_from_string(self, name, key_material, ex_location):

    action = self._get_project_action('sshkey')
    data = {'name': name, 'publicKey': key_material, 'region': ex_location.id}
    response = self.connection.request(action, data=data, method='POST')
    return self._to_key_pair(response.object)
