def fix_torrent(file_path):
 f = open(file_path, 'rb')
 bdata = f.read()
 f.close()
 fixed_data = bdecode(bdata)
 if (fixed_data is not None):
  fixed_data = bencode(fixed_data)
 return fixed_data

def fix_torrent ( file_path ) : f = open ( file_path , 'rb' ) bdata = f . read ( ) f . close ( ) fixed_data = bdecode ( bdata ) if ( fixed_data is not None ) : fixed_data = bencode ( fixed_data ) return fixed_data
reads and checks if a torrent file is valid and tries to overwrite the torrent file with a non-sloppy version .