'Get an ec2 keypair via v3/credentials, by id or access.'

def get_ec2_keypair(self, credential_id=None, access=None, user_id=None):

    if credential_id:
        cred = self.client.credentials.get(credential_id)
        ec2_creds = jsonutils.loads(cred.blob)
        return AccessKey(id=cred.id, access=ec2_creds['access'], secret=ec2_creds['secret'])
    elif access:
        return self._find_ec2_keypair(access=access, user_id=user_id)
    else:
        raise ValueError('Must    specify    either    credential_id    or    access')
