def chooseSize(string):
  """
    Determines appropriate latex size to use so that the string fits in RAVEN-standard lstlisting examples
      without flowing over to newline.  Could be improved to consider the overall number of lines in the
      string as well, so that we don't have multi-page examples very often.
    @ In, string, string, the string by which to determine the size
    @ Out, chooseSize, string, the LaTeX-ready size at which the string should be represented
  """
  longest = 0
  for line in string.split('\n'):
    longest = max(longest,len(line.rstrip()))
  if longest < 64:
    return '\\normalsize'
  elif longest < 70:
    return '\\small'
  elif longest < 77:
    return '\\footnotesize'
  elif longest < 96:
    return '\\scriptsize'
  else:
    return '\\tiny'