code: def create_self_signed(cls, name, common_name, public_key_algorithm='rsa',
              signature_algorithm='rsa_sha_512', key_length=4096):
          
          tls = TLSServerCredential.create_csr(name=name, common_name=common_name,
              public_key_algorithm=public_key_algorithm, signature_algorithm=signature_algorithm,
              key_length=key_length)
          try:
              tls.self_sign()
          except ActionCommandFailed:
              tls.delete()
              raise
          return tls
docs: Create a self signed certificate. This is a convenience method that
          first calls :meth:`~create_csr`, then calls :meth:`~self_sign` on the
          returned TLSServerCredential object.
          
          :param str name: name of TLS Server Credential
          :param str rcommon_name: common name for certificate. An example
              would be: "CN=CommonName,O=Organization,OU=Unit,C=FR,ST=PACA,L=Nice".
              At minimum, a "CN" is required.
          :param str public_key_algorithm: public key type to use. Valid values
              rsa, dsa, ecdsa.
          :param str signature_algorithm: signature algorithm. Valid values
              dsa_sha_1, dsa_sha_224, dsa_sha_256, rsa_md5, rsa_sha_1, rsa_sha_256,
              rsa_sha_384, rsa_sha_512, ecdsa_sha_1, ecdsa_sha_256, ecdsa_sha_384,
              ecdsa_sha_512. (Default: rsa_sha_512)
          :param int key_length: length of key. Key length depends on the key
              type. For example, RSA keys can be 1024, 2048, 3072, 4096. See SMC
              documentation for more details.
          :raises CreateElementFailed: failed to create CSR
          :raises ActionCommandFailed: Failure to self sign the certificate
          :rtype: TLSServerCredential