code: def append_condition(statement, condition, key, value):
      
      if isinstance(statement, list):
          statement.append({condition: {key: value}})
      if isinstance(statement, dict):
          statement[condition] = {key: value}
docs: >>> list = []
      >>> append_condition(list, 'match', 'name', 'Jack')
      >>> list
      [{'match': {'name': 'Jack'}}]
      >>> dict = {}
      >>> append_condition(dict, 'match', 'name', 'Marry')
      >>> dict
      {'match': {'name': 'Marry'}}