def get_policy_string(base, policy_or_index):
 if isinstance(policy_or_index, BaseStoragePolicy):
  policy = policy_or_index
 else:
  policy = POLICIES.get_by_index(policy_or_index)
  if (policy is None):
   raise PolicyError('Unknown policy', index=policy_or_index)
 return _get_policy_string(base, int(policy))

def get_policy_string ( base , policy_or_index ) : if isinstance ( policy_or_index , BaseStoragePolicy ) : policy = policy_or_index else : policy = POLICIES . get_by_index ( policy_or_index ) if ( policy is None ) : raise PolicyError ( 'Unknown policy' , index = policy_or_index ) return _get_policy_string ( base , int ( policy ) )
helper function to construct a string from a base and the policy .