from multiprocessing import RLock as rlockp
from threading import RLock as rlockt


def create_rlock(process=False):
    """Creates a reentrant lock object."""
    if process:
        return rlockp()
    else:
        return rlockt()