code: def post_transaction(self, transaction, mode):
          
          if not mode or mode not in self.mode_list:
              raise ValidationError('Mode must be one of the following {}.'
                                    .format(', '.join(self.mode_list)))
  
          tx_dict = transaction.tx_dict if transaction.tx_dict else transaction.to_dict()
          payload = {
              'method': mode,
              'jsonrpc': '2.0',
              'params': [encode_transaction(tx_dict)],
              'id': str(uuid4())
          }
          # TODO: handle connection errors!
          return requests.post(self.endpoint, json=payload)
docs: Submit a valid transaction to the mempool.