lockutils: split code handling internal/external lock
lockutils: split code handling internal/external lock

This makes the code much more readable and hackable.

Change-Id: I7f209c793eb7e2c5daaa068835d29a12a7e064a8

varunarya10/oslo.concurrency,JioCloud/oslo.concurrency,openstack/oslo.concurrency