code: def make_filename_hash(key):
      
      key_repr = repr(key).replace(BASE_DIR, '').encode('utf8')
      # This is really stupid but necessary for making the repr()s be the same on
      # Python 2 and 3 and thus allowing the test suite to run on both.
      # TODO better solutions include: not using a repr, not embedding hashes in
      # the expected test results
      if sys.platform == 'win32':
          # this is to make sure the hash is the same on win and unix platforms
          key_repr = key_repr.replace(b'\\\\', b'/')
      key_repr = re.sub(b"\\bu'", b"'", key_repr)
      key_hash = hashlib.md5(key_repr).digest()
      return base64.b64encode(key_hash, b'__').decode('ascii').rstrip('=')
docs: Convert the given key (a simple Python object) to a unique-ish hash
      suitable for a filename.