Getting local coordinate system orientation data?

I can’t seem to find any function that gathers data about the orientation of the local coordinate system relative to another, say the global or camera. I think the 2.49 blender game engine has something that evaluates the local coordinate system relative to global space. However, I would need this to work outside of the bge environment.

Anyone know of any way to determine this?

ob.getMatrix(‘worldspace’) gives you the transformation matrix of an object.see http://www.blender.org/documentation/249PythonDoc/Object.Object-class.html#getMatrix

for useful functions to manipulate/use that matrix see Mathutil.Matrix

cheers