'>>> lock = LockBase(\'somefile\')
>>> lock = LockBase(\'somefile\', threaded=False)'

def __init__(self, path, threaded=True, timeout=None):

    super(LockBase, self).__init__(path)
    self.lock_file = (os.path.abspath(path) + '.lock')
    self.hostname = socket.gethostname()
    self.pid = os.getpid()
    if threaded:
        t = threading.current_thread()
        ident = getattr(t, 'ident', hash(t))
        self.tname = ('-%x' % (ident & 4294967295))
    else:
        self.tname = ''
    dirname = os.path.dirname(self.lock_file)
    self.unique_name = os.path.join(dirname, ('%s%s.%s%s' % (self.hostname, self.tname, self.pid, hash(self.path))))
    self.timeout = timeout
