code: def _cli_check_ref_format(fmt):
      '''Checks that a reference format exists and if not, raises a helpful exception'''
  
      if fmt is None:
          return None
  
      fmt = fmt.lower()
      if not fmt in api.get_reference_formats():
          errstr = "Reference format '" + fmt + "' does not exist.\n"
          errstr += "For a complete list of formats, use the 'bse list-ref-formats' command"
          raise RuntimeError(errstr)
  
      return fmf _cli_check_ref_format(fmt):
      '''Checks that a reference format exists and if not, raises a helpful exception'''
  
      if fmt is None:
          return None
  
      fmt = fmt.lower()
      if not fmt in api.get_reference_formats():
          errstr = "Reference format '" + fmt + "' does not exist.\n"
          errstr += "For a complete list of formats, use the 'bse list-ref-formats' command"
          raise RuntimeError(errstr)
  
      return fmt
docs: Checks that a reference format exists and if not, raises a helpful exception