code: def setpurpose(self, purpose):
          
          if isinstance(purpose, str):
              purp_no = libcrypto.X509_PURPOSE_get_by_sname(purpose)
              if purp_no <= 0:
                  raise X509Error("Invalid certificate purpose '%s'" % purpose)
          elif isinstance(purpose, int):
              purp_no = purpose
          if libcrypto.X509_STORE_set_purpose(self.store, purp_no) <= 0:
              raise X509Error("cannot set purpose")
docs: Sets certificate purpose which verified certificate should match
          @param purpose - number from 1 to 9 or standard strind defined
                           in Openssl
          possible strings - sslcient,sslserver, nssslserver, smimesign,i
                           smimeencrypt, crlsign, any, ocsphelper