code: def base64_decodestring(instr):
      '''
      Decode a base64-encoded string using the "legacy" Python interface.
      '''
      b = salt.utils.stringutils.to_bytes(instr)
      try:
          # PY3
          decoded = base64.decodebytes(b)
      except AttributeError:
          # PY2
          decoded = base64.decodestring(b)
      try:
          return salt.utils.stringutils.to_unicode(
              decoded,
              encoding='utf8' if salt.utils.platform.is_windows() else None
          )
      except UnicodeDecodeError:
          return decodef base64_decodestring(instr):
      '''
      Decode a base64-encoded string using the "legacy" Python interface.
      '''
      b = salt.utils.stringutils.to_bytes(instr)
      try:
          # PY3
          decoded = base64.decodebytes(b)
      except AttributeError:
          # PY2
          decoded = base64.decodestring(b)
      try:
          return salt.utils.stringutils.to_unicode(
              decoded,
              encoding='utf8' if salt.utils.platform.is_windows() else None
          )
      except UnicodeDecodeError:
          return decoded
docs: Decode a base64-encoded string using the "legacy" Python interface.