code: def expected_related_units(reltype=None):
      
      if not has_juju_version("2.4.4"):
          # goal-state existed in 2.4.0, but did not list individual units to
          # join a relation in 2.4.1 through 2.4.3. (LP: #1794739)
          raise NotImplementedError("goal-state relation unit count")
      reltype = reltype or relation_type()
      _goal_state = goal_state()
      return (key for key in _goal_state['relations'][reltype] if '/' in key)
docs: Get a generator for units we expect to join relation based on
      goal-state.
  
      Note that you can not use this function for the peer relation, take a look
      at expected_peer_units() for that.
  
      This function will raise KeyError if you request information for a
      relation type for which juju goal-state does not have information.  It will
      raise NotImplementedError if used with juju versions without goal-state
      support.
  
      Example usage:
      log('participant {} of {} joined relation {}'
          .format(len(related_units()),
                  len(list(expected_related_units())),
                  relation_type()))
  
      :param reltype: Relation type to list data for, default is to list data for
                      the realtion type we are currently executing a hook for.
      :type reltype: str
      :returns: iterator
      :rtype: types.GeneratorType
      :raises: KeyError, NotImplementedError