code: def apply_upstring(upstring, component_list):
      
      assert len(upstring) == len(component_list)
  
      def add_up_key(comp_dict, up_indicator):
          assert up_indicator == 'U' or up_indicator == "_"
          comp_dict['up'] = up_indicator == 'U'
  
      for comp_dict, up_indicator in zip(component_list, upstring):
          add_up_key(comp_dict, up_indicator)
docs: Update the dictionaries resulting from ``parse_array_start`` with
      the "up" key based on the upstring returned from ``parse_upstring``.
  
      The function assumes that the upstring and component_list parameters
      passed in are from the same device array stanza of a
      ``/proc/mdstat`` file.
  
      The function modifies component_list in place, adding or updating
      the value of the "up" key to True if there is a corresponding ``U``
      in the upstring string, or to False if there is a corresponding
      ``_``.
  
      If there the number of rows in component_list does not match the
      number of characters in upstring, an ``AssertionError`` is raised.
  
      Parameters
      ----------
  
      upstring : str
          String sequence of ``U``s and ``_``s as determined by the
          ``parse_upstring`` method
  
      component_list : list
          List of dictionaries output from the ``parse_array_start`` method.