def extract_policy(obj_path):
 try:
  obj_portion = obj_path[obj_path.rindex(DATADIR_BASE):]
  obj_dirname = obj_portion[:obj_portion.index('/')]
 except Exception:
  return None
 try:
  (base, policy) = split_policy_string(obj_dirname)
 except PolicyError:
  return None
 return policy

def extract_policy ( obj_path ) : try : obj_portion = obj_path [ obj_path . rindex ( DATADIR_BASE ) : ] obj_dirname = obj_portion [ : obj_portion . index ( '/' ) ] except Exception : return None try : ( base , policy ) = split_policy_string ( obj_dirname ) except PolicyError : return None return policy
extracts the policy for an object given the device-relative path to the object .