<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def down(queue, user=None, group=None, mode=None, host=None) :
    '''Down a queue, by creating a down file'''
    # default our owners and mode
    user, group, mode = _dflts(user, group, mode)
    down_path = fsq_path.down(queue, host=host)
    fd = None
    created = False
    try:
        # try to guarentee creation
        try:
            fd = os.open(down_path, os.O_CREAT|os.O_WRONLY|os.O_EXCL, mode)
            created = True
        except (OSError, IOError, ), e:
            if e.errno != errno.EEXIST:
                raise e
            fd = os.open(down_path, os.O_CREAT|os.O_WRONLY, mode)
        if user is not None or group is not None:
            os.fchown(fd, *uid_gid(user, group, fd=fd))
        if not created:
            os.fchmod(fd, mode)
    except (OSError, IOError, ), e:
        if created:
            _cleanup(down_path, e)
        _raise(down_path, e)
    finally:
        if fd is not None:
            os.close(fd)