code: def _do_identity_policy_create(args):
      
      signer = _read_signer(args.key)
  
      txns = [_create_policy_txn(signer, args.name, args.rule)]
  
      batch = _create_batch(signer, txns)
  
      batch_list = BatchList(batches=[batch])
  
      if args.output is not None:
          try:
              with open(args.output, 'wb') as batch_file:
                  batch_file.write(batch_list.SerializeToString())
          except IOError as e:
              raise CliException(
                  'Unable to write to batch file: {}'.format(str(e)))
      elif args.url is not None:
          rest_client = RestClient(args.url)
          rest_client.send_batches(batch_list)
          if args.wait and args.wait > 0:
              batch_id = batch.header_signature
              wait_time = 0
              start_time = time.time()
  
              while wait_time < args.wait:
                  statuses = rest_client.get_statuses(
                      [batch_id],
                      args.wait - int(wait_time))
                  wait_time = time.time() - start_time
                  if statuses[0]['status'] == 'COMMITTED':
                      print(
                          'Policy committed in {:.6} sec'.format(wait_time))
                      return
  
                  # Wait a moment so as not to hammer the Rest Api
                  time.sleep(0.2)
  
              print('Wait timed out! Policy was not committed...')
              print('{:128.128}  {}'.format(
                  batch_id,
                  statuses[0]['status']))
              exit(1)
      else:
          raise AssertionError('No target for create set.')
docs: Executes the 'policy create' subcommand.  Given a key file, and a
      series of entries, it generates a batch of sawtooth_identity
      transactions in a BatchList instance. The BatchList is either stored to a
      file or submitted to a validator, depending on the supplied CLI arguments.