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

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

    self.path = path
    self.lock_file = (os.path.abspath(path) + '.lock')
    self.hostname = socket.gethostname()
    self.pid = os.getpid()
    if threaded:
        name = threading.current_thread().get_name()
        tname = ('%s-' % urllib.quote(name, safe=''))
    else:
        tname = ''
    dirname = os.path.dirname(self.lock_file)
    self.unique_name = os.path.join(dirname, ('%s.%s%s' % (self.hostname, tname, self.pid)))
