code: def __safe_name(self, method_name):
      
      # Endpoints backend restricts what chars are allowed in a method name.
      safe_name = re.sub(r'[^\.a-zA-Z0-9_]', '', method_name)
  
      # Strip any number of leading underscores.
      safe_name = safe_name.lstrip('_')
  
      # Ensure the first character is lowercase.
      # Slice from 0:1 rather than indexing [0] in case safe_name is length 0.
      return safe_name[0:1].lower() + safe_name[1:]
docs: Restrict method name to a-zA-Z0-9_, first char lowercase.