[python bindings] Added code to get the length of a memory buffer. Tests are included.