AVSync algorithm implemented in Python.