code: def get_domain_listing(self, domain, sort='hot', period=None, *args,
                             **kwargs):
          if sort not in ('controversial', 'hot', 'new', 'rising', 'top',
                          'gilded'):
              raise TypeError('Invalid sort parameter.')
          if period not in (None, 'all', 'day', 'hour', 'month', 'week', 'year'):
              raise TypeError('Invalid period parameter.')
          if sort not in ('controversial', 'top') and period:
              raise TypeError('Period cannot be set for that sort argument.')
          url = self.config['domain'].format(domain=domain)
          if sort != 'hot':
              url += sort
          if period:
              kwargs.setdefault('params', {})['t'] = period
          return self.get_content(url, *args, **kwargs)