code: def safe_unicode(string):
      
      if not PY3:
          uni = string.replace(u'\u2019', "'")
          return uni.encode('utf-8')
          
      return string
docs: If Python 2, replace non-ascii characters and return encoded string.