Get a lock for an object.
If the object is equal to another object gotten through this function then
the lock will be identical. As long as the lock is referenced IE: not garbage collected,
the original object will be referenced as well so holding locks on large objects will
cause memory leakage. Because of the guarantee of the same lock being used for equivilent
objects, you can get locks as needed and throw them out when you are done with them.