parameters: (val, symbol=True, grouping=False, international=False)
return_statement: return s.replace('<', '').replace('>', '')
docstring: Formats val according to the currency settings
      in the current locale.
docstring_summary: Formats val according to the currency settings
      in the current locale.
docstring_tokens: Formats val according to the currency settings in the current locale .
function: def currency(val, symbol=True, grouping=False, international=False):
      """Formats val according to the currency settings
      in the current locale."""
      conv = localeconv()
  
      # check for illegal values
      digits = conv[international and 'int_frac_digits' or 'frac_digits']
      if digits == 127:
          raise ValueError("Currency formatting is not possible using "
                           "the 'C' locale.")
  
      s = _format('%%.%if' % digits, abs(val), grouping, monetary=True)
      # '<' and '>' are markers if the sign must be inserted between symbol and value
      s = '<' + s + '>'
  
      if symbol:
          smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
          precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
          separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
  
          if precedes:
              s = smb + (separated and ' ' or '') + s
          else:
              s = s + (separated and ' ' or '') + smb
  
      sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
      sign = conv[val<0 and 'negative_sign' or 'positive_sign']
  
      if sign_pos == 0:
          s = '(' + s + ')'
      elif sign_pos == 1:
          s = sign + s
      elif sign_pos == 2:
          s = s + sign
      elif sign_pos == 3:
          s = s.replace('<', sign)
      elif sign_pos == 4:
          s = s.replace('>', sign)
      else:
          # the default if nothing specified;
          # this should be the most fitting sign position
          s = sign + s
  
      return s.replace('<', '').replace('>', '')
function_tokens: def currency ( val , symbol = True , grouping = False , international = False ) : conv = localeconv ( ) # check for illegal values digits = conv [ international and 'int_frac_digits' or 'frac_digits' ] if digits == 127 : raise ValueError ( "Currency formatting is not possible using " "the 'C' locale." ) s = _format ( '%%.%if' % digits , abs ( val ) , grouping , monetary = True ) # '<' and '>' are markers if the sign must be inserted between symbol and value s = '<' + s + '>' if symbol : smb = conv [ international and 'int_curr_symbol' or 'currency_symbol' ] precedes = conv [ val < 0 and 'n_cs_precedes' or 'p_cs_precedes' ] separated = conv [ val < 0 and 'n_sep_by_space' or 'p_sep_by_space' ] if precedes : s = smb + ( separated and ' ' or '' ) + s else : s = s + ( separated and ' ' or '' ) + smb sign_pos = conv [ val < 0 and 'n_sign_posn' or 'p_sign_posn' ] sign = conv [ val < 0 and 'negative_sign' or 'positive_sign' ] if sign_pos == 0 : s = '(' + s + ')' elif sign_pos == 1 : s = sign + s elif sign_pos == 2 : s = s + sign elif sign_pos == 3 : s = s . replace ( '<' , sign ) elif sign_pos == 4 : s = s . replace ( '>' , sign ) else : # the default if nothing specified; # this should be the most fitting sign position s = sign + s return s . replace ( '<' , '' ) . replace ( '>' , '' )