def cin(prompt=">> ", default="q", raw=False):
  """
  A general prompt for operator input. Kind of simulates a terminal. Will
  display whatever prompt is (with no newlines, unless they are explicitly in
  prompt) and accept input from the operator. If the user enteres nothing or
  whitespaces only, then the prompt will be re-printed (just like a terminal).
  In the case that the operator enters Ctrl+D (EOF) or Ctrl+C (KBI), the
  default is returned.

    Inputs:
      prompt: str - The message to display when asking for input
      default: str - The string to be returned in the event of EOF or KBI
      raw: bool - If this is True, will return any leading or trailing
                  whitespace. Otherwise will return the stripped input.
  """
  try:
    while True:
      choice = input(prompt)
      if choice.strip() == "":
        continue
      if raw:
        return choice
      return choice.strip()
  except (EOFError, KeyboardInterrupt):
    return default