<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_user_to_group(uid, gid, exist_ok=True):
 """ Adds a user to a group within DCOS Enterprise. The group and user must exist. :param uid: user id :type uid: str :param gid: group id :type gid: str :param exist_ok: True if it is ok for the relationship to pre-exist. :type exist_ok: bool """

    acl_url = urljoin(_acl_url(), 'groups/{}/users/{}'.format(gid, uid))
    try:
        r = http.put(acl_url)
        assert r.status_code == 204
    except DCOSHTTPException as e:
        if e.response.status_code == 409 and exist_ok:
            pass
        else:
            raise