def locked(filename=None):
    with open(filename, 'a') as fh:
        try:
            _flock(fh, LOCK_EX | LOCK_NB)
            ret = False
        except IOError as e:
            if e.errno == errno.EAGAIN:
                log.debug('{0} is locked: {1}'.format(filename, e))
                ret = True
            else:
                ret = False
    return ret
:param filename:
dataset/ETHPy150Open Netflix/aminator/aminator/util/linux.py/locked