code: def combine_reducers(reducers):
      
      final_reducers = {key: reducer
                        for key, reducer in reducers.items()
                        if hasattr(reducer, '__call__')}
  
      sanity_error = None
      try:
          assert_reducer_sanity(final_reducers)
      except Exception as e:
          sanity_error = e
  
      def combination(state=None, action=None):
          if state is None:
              state = {}
          if sanity_error:
              raise sanity_error
  
          has_changed = False
          next_state = {}
          for key, reducer in final_reducers.items():
              previous_state_for_key = state.get(key)
              next_state_for_key = reducer(previous_state_for_key, action)
              if next_state_for_key is None:
                  msg = get_undefined_state_error_message(key, action)
                  raise Exception(msg)
              next_state[key] = next_state_for_key
              has_changed = (has_changed or
                             next_state_for_key != previous_state_for_key)
          return next_state if has_changed else state
  
      return combination
docs: composition tool for creating reducer trees.
     
      Args:
          reducers: dict with state keys and reducer functions
                    that are responsible for each key
  
      Returns:
          a new, combined reducer function