code: def parse_input(self, input: Optional[str]) -> None:
      self.raw_input = input
      if input is None and self.default is None:
          raise BadGrammar(
              f"{self.name} has no default, please use one of the following options: {self.options}"
          )
      if input is None:
          if isinstance(self.default, str):
              input = self.default
          elif callable(self.default):
              input = self.default()
  
      if len(self.options) > 0 and input not in self.options:
          raise BadGrammar(
              f"{input} is not valid for {self.name} please use one of the following options: {self.options}"
          )
  
      self.input = self.custom_parsing(input=input) if input else input
  
imports: from __future__ import annotations
  import socket
  from typing import Any
  from typing import Callable
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Tuple
  from typing import Union
  from .deps import allowed_hosts
  from .lib import find_available_port
label_desc: Use image node_id 7 for calling the GrammarTerm obj's underlying member method code with example usage: obj.parse_input(input) without return types