code: def format(self, locale=LC_NUMERIC, pattern=None, currency_digits=True,
                 format_type='standard'):
          
          if BABEL_AVAILABLE:
              if BABEL_VERSION < StrictVersion('2.2'):
                  raise Exception('Babel {} is unsupported. '
                      'Please upgrade to 2.2 or higher.'.format(BABEL_VERSION))
              return babel.numbers.format_currency(
                  self._amount, self._currency, format=pattern, locale=locale,
                  currency_digits=currency_digits, format_type=format_type)
          else:
              raise NotImplementedError("formatting requires Babel "
                                        "(https://pypi.python.org/pypi/Babel)")
docs: Return a locale-aware, currency-formatted string.
          
          This method emulates babel.numbers.format_currency().
          
          A specific locale identifier (language[_territory]) can be passed,
          otherwise the system's default locale will be used. A custom
          formatting pattern of the form "¤#,##0.00;(¤#,##0.00)"
          (positive[;negative]) can also be passed, otherwise it will be
          determined from the locale and the CLDR (Unicode Common Locale Data
          Repository) included with Babel.
          
          >>> m = Money('1234.567', 'EUR')
          >>> m.format() # assuming the system's locale is 'en_US'
          €1,234.57
          >>> m.format('de_DE') # German formatting
          1.234,57 €
          >>> m.format('de', '#,##0 ¤') # German formatting (short), no cents
          1.235 €
          >>> m.format(pattern='#,##0.00 ¤¤¤') # Default locale, full name
          1,235.57 euro
          
          Learn more about this formatting syntaxis at:
          http://www.unicode.org/reports/tr35/tr35-numbers.html