code: def _to_component(obj, allow_hierarchy=True):
      
  
      def _to_str(obj):
          return "{}:{}".format(obj.kind, obj.component)
  
      if isinstance(obj, str):
          # TODO: check to see if valid?, use allow_hierarchy
          # TODO: when passed labels this is going to give the wrong thing, but that might be fixable in the HierarchyParameter set_value check
          #~ raise NotImplementedError # need to get object from bundle and pass to _to_str
          return obj
      elif isinstance(obj, ParameterSet):
          # TODO: be smarter about this and don't assume only 1 will be returned
          if 'repr' in obj.to_flat_dict().keys():
              return obj.get_value(qualifier='repr')
  
          else:
              # make sure we only have things in the 'component' context
              obj = obj.filter(context='component')
              return _to_str(obj)
  
      elif isinstance(obj, Parameter):
          if obj.qualifier == 'repr':
              return obj.get_value()
          else:
              return _to_str(obj)
  
      else:
          raise NotImplementedError("could not parse {}".format(obj))
docs: takes either a string, ParameterSet, Parameter, or the string representation (component or nested hierarchy)