code: def username(self, template: Optional[str] = None) -> str:
          
          MIN_DATE = 1800
          MAX_DATE = 2070
          DEFAULT_TEMPLATE = 'l.d'
  
          templates = ('U_d', 'U.d', 'U-d', 'UU-d', 'UU.d', 'UU_d',
                       'ld', 'l-d', 'Ud', 'l.d', 'l_d', 'default')
  
          if template is None:
              template = self.random.choice(templates)
  
          if template == 'default':
              template = DEFAULT_TEMPLATE
  
          if not re.fullmatch(r'[Ul\.\-\_d]*[Ul]+[Ul\.\-\_d]*', template):
              raise ValueError(
                  "Template '{}' is not supported.".format(template))
  
          tags = re.findall(r'[Uld\.\-\_]', template)
  
          username = ''
          for tag in tags:
              if tag == 'U':
                  username += self.random.choice(USERNAMES).capitalize()
              elif tag == 'l':
                  username += self.random.choice(USERNAMES)
              elif tag == 'd':
                  username += str(self.random.randint(MIN_DATE, MAX_DATE))
              elif tag in '-_.':
                  username += tag
  
          return username
docs: Generate username by template.
  
          Supported template placeholders: (U, l, d)
  
          Supported separators: (-, ., _)
  
          Template must contain at least one "U" or "l" placeholder.
  
          If template is None one of the following templates is used:
          ('U_d', 'U.d', 'U-d', 'UU-d', 'UU.d', 'UU_d',
          'ld', 'l-d', 'Ud', 'l.d', 'l_d', 'default')
  
          :param template: Template.
          :return: Username.
          :raises ValueError: If template is not supported.
  
          :Example:
              Celloid1873