'Create a new key pair object.
:param name: Key pair name.
:type name: ``str``
:param     name: Name of the keypair (required)
:type      name: ``str``
:param     projectid: An optional project for the ssh key
:type      projectid: ``str``
:param     domainid: An optional domainId for the ssh key.
If the account parameter is used,
domainId must also be used.
:type      domainid: ``str``
:param     account: An optional account for the ssh key.
Must be used with domainId.
:type      account: ``str``
:return:   Created key pair object.
:rtype:    :class:`libcloud.compute.base.KeyPair`'

def create_key_pair(self, name, **kwargs):

    extra_args = kwargs.copy()
    params = {'name': name}
    params.update(extra_args)
    res = self._sync_request(command='createSSHKeyPair', params=params, method='GET')
    key_pair = self._to_key_pair(data=res['keypair'])
    return key_pair
