code: def get_name(name_or_obj):
      
      if isinstance(name_or_obj, six.string_types):
          # It's a name
          return name_or_obj
      try:
          return name_or_obj.name
      except AttributeError:
          raise exc.MissingName(name_or_obj)
docs: Returns the 'name' attribute of 'name_or_obj' if present; if not,
      returns 'name_or_obj'.