code: def _AnsiCmd(command_list):
    
    if not isinstance(command_list, list):
      raise ValueError('Invalid list: %s' % command_list)
    # Checks that entries are valid SGR names.
    # No checking is done for sequences that are correct but 'nonsensical'.
    for sgr in command_list:
      if sgr.lower() not in SGR:
        raise ValueError('Invalid or unsupported SGR name: %s' % sgr)
    # Convert to numerical strings.
    command_str = [str(SGR[x.lower()]) for x in command_list]
    # Wrap values in Ansi escape sequence (CSI prefix & SGR suffix).
    return '\033[%sm' % (';'.join(command_str))
docs: Takes a list of SGR values and formats them as an ANSI escape sequence.
  
    Args:
      command_list: List of strings, each string represents an SGR value.
          e.g. 'fg_blue', 'bg_yellow'
  
    Returns:
      The ANSI escape sequence.
  
    Raises:
      ValueError: if a member of command_list does not map to a valid SGR value.