code: def _extract_optimizer_param_name_and_group(optimizer_name, param):
      
      pat_1 = '__param_groups__(?P<group>[0-9])__(?P<name>.+)'
      pat_2 = '__(?!.*__.*)(?P<name>.+)'
      pat_1 = optimizer_name + pat_1
      pat_2 = optimizer_name + pat_2
  
      match_1 = re.compile(pat_1).fullmatch(param)
      match_2 = re.compile(pat_2).fullmatch(param)
      match = match_1 or match_2
  
      if not match:
          raise AttributeError('Invalid parameter "{}" for optimizer "{}"'.format(
              param,
              optimizer_name,
          ))
  
      groups = match.groupdict()
      param_group = groups.get('group', 'all')
      param_name = groups['name']
      return param_group, param_name
docs: Extract param group and param name from the given parameter name.
      Raises an error if the param name doesn't match one of
      - ``optimizer__param_groups__<group>__<name>``
      - ``optimizer__<name>``
      In the second case group defaults to 'all'.
      The second case explicitly forbids ``optimizer__foo__bar``
      since we do not know how to deal with unknown sub-params.