'Retrieve a single key pair.
:param name: Name of the key pair to retrieve.
:type name: ``str``
:rtype: :class:`.KeyPair`'

def get_key_pair(self, name):

    params = {'name': name}
    res = self._sync_request(command='listSSHKeyPairs', params=params, method='GET')
    key_pairs = res.get('sshkeypair', [])
    if (len(key_pairs) == 0):
        raise KeyPairDoesNotExistError(name=name, driver=self)
    key_pair = self._to_key_pair(data=key_pairs[0])
    return key_pair
