code: def validate_txn_obj(obj_name, obj, key, validation_fun):
      
      backend = bigchaindb.config['database']['backend']
  
      if backend == 'localmongodb':
          data = obj.get(key, {})
          if isinstance(data, dict):
              validate_all_keys_in_obj(obj_name, data, validation_fun)
          elif isinstance(data, list):
              validate_all_items_in_list(obj_name, data, validation_fun)
docs: Validate value of `key` in `obj` using `validation_fun`.
  
          Args:
              obj_name (str): name for `obj` being validated.
              obj (dict): dictionary object.
              key (str): key to be validated in `obj`.
              validation_fun (function): function used to validate the value
              of `key`.
  
          Returns:
              None: indicates validation successful
  
          Raises:
              ValidationError: `validation_fun` will raise exception on failure