'Return credentials from an ID.
:param credential_id: id of credential
:raises keystone.exception.Unauthorized: when credential id is invalid
or when the credential type is not ec2
:returns: credential: dict of ec2 credential.'

def _get_credentials(self, credential_id):

    ec2_credential_id = utils.hash_access_key(credential_id)
    cred = self.credential_api.get_credential(ec2_credential_id)
    if ((not cred) or (cred['type'] != CRED_TYPE_EC2)):
        raise exception.Unauthorized(message=_('EC2    access    key    not    found.'))
    return self._convert_v3_to_ec2_credential(cred)
