code: def _get_reference_instnames(self, instname, namespace, resultclass_name,
                                   role):
          
          instance_repo = self._get_instance_repo(namespace)
  
          if resultclass_name:
              # if there is a class repository get subclasses
              if self._get_class_repo(namespace):
                  resultclass_dict = self._classnamedict(resultclass_name,
                                                         namespace)
              else:
                  resultclass_dict = NocaseDict(resultclass_name=resultclass_name)
          else:
              resultclass_dict = NocaseDict()
  
          instname.namespace = namespace
          rtn_instpaths = []
          role = role.lower() if role else role
          # TODO:ks FUTURE: Make list from _get_reference_classnames if classes
          #       exist. Otherwise set list to instance_repo to search every
          #       instance.
          for inst in instance_repo:
              for prop in six.itervalues(inst.properties):
                  if prop.type == 'reference':
                      # does this prop instance name match target inst name
                      if prop.value == instname:
                          if resultclass_name:
                              if inst.classname not in resultclass_dict:
                                  continue
                          if role and prop.name.lower() != role:
                              continue
  
                          self._appendpath_unique(rtn_instpaths, inst.path)
  
          return rtn_instpaths
docs: Get the reference instances from the repository for the target
          instname and filtered by the result_class and role parameters.
  
          Returns a list of the reference instance names. The returned list is
          the original, not a copy so the user must copy them