def to_ascii(s):
      "Raise PermError if arg is not 7-bit ascii."
      try:
        return s.decode('ascii')
      except UnicodeError:
        raise PermError('Non-ascii characters found',repr(s))
Raise PermError if arg is not 7-bit ascii.
python/spf.py