def split_policy_string(policy_string):
 if ('-' in policy_string):
  (base, policy_index) = policy_string.rsplit('-', 1)
 else:
  (base, policy_index) = (policy_string, None)
 policy = POLICIES.get_by_index(policy_index)
 if (get_policy_string(base, policy) != policy_string):
  raise PolicyError('Unknown policy', index=policy_index)
 return (base, policy)

def split_policy_string ( policy_string ) : if ( '-' in policy_string ) : ( base , policy_index ) = policy_string . rsplit ( '-' , 1 ) else : ( base , policy_index ) = ( policy_string , None ) policy = POLICIES . get_by_index ( policy_index ) if ( get_policy_string ( base , policy ) != policy_string ) : raise PolicyError ( 'Unknown policy' , index = policy_index ) return ( base , policy )
helper function to convert a string representing a base and a policy .