docs: def _b64encode_to_str(data):
      """
      Wrapper around b64encode which takes and returns same-named types
      on both Python 2 and Python 3.
      :type data: bytes
      :return: str
      """
      ret = b64encode(data)
      if not isinstance(ret, str):  # Python3
          return ret.decode('ascii')
      else:
          return ret