def find_resource(manager, name_or_id):
 try:
  return manager.get(name_or_id)
 except ksa_exceptions.NotFound:
  pass
 try:
  if isinstance(name_or_id, six.binary_type):
   name_or_id = name_or_id.decode('utf-8', 'strict')
  return manager.find(name=name_or_id)
 except ksa_exceptions.NotFound:
  msg = ("No %s with a name or ID of '%s' exists." % (manager.resource_class.__name__.lower(), name_or_id))
  raise ksc_exceptions.CommandError(msg)
 except ksc_exceptions.NoUniqueMatch:
  msg = ("Multiple %s matches found for '%s', use an ID to be more specific." % (manager.resource_class.__name__.lower(), name_or_id))
  raise ksc_exceptions.CommandError(msg)

def find_resource ( manager , name_or_id ) : try : return manager . get ( name_or_id ) except ksa_exceptions . NotFound : pass try : if isinstance ( name_or_id , six . binary_type ) : name_or_id = name_or_id . decode ( 'utf-8' , 'strict' ) return manager . find ( name = name_or_id ) except ksa_exceptions . NotFound : msg = ( "No %s with a name or ID of '%s' exists." % ( manager . resource_class . __name__ . lower ( ) , name_or_id ) ) raise ksc_exceptions . CommandError ( msg ) except ksc_exceptions . NoUniqueMatch : msg = ( "Multiple %s matches found for '%s', use an ID to be more specific." % ( manager . resource_class . __name__ . lower ( ) , name_or_id ) ) raise ksc_exceptions . CommandError ( msg )
given a resource object and a string or tuple representing a path .