[test framework] add a python implementation for merkle trees
Summary: This will be used in D16569 to verify the results returned by chronik in the functional test.
Test Plan: ninja check-functional
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D16756