public function findCertificate($name)
    {
        foreach ($this->accounttypes as $type) {
            foreach ($this->accounts[$type] as $account) {
                // Skip empty accounts with no visible certificates
                if (!isset($account['certificates'])) {
                   continue;
                }
                foreach ($account['certificates'] as $certificate) {
                    if ($certificate['name'] == $name) {
                        $certificate['accounttype'] = $type;
                        $certificate['pemurl'] = $this->baseurl.'/'.$type.'/accounts/'.$certificate['account_id'].'/certificates/'.$certificate['id'].'/pem';

                        return $certificate;
                    }
                }
            }
        }
    }