<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def warn_user(channel, user):
 """ Gives a user a warning, and bans them if they are over the maximum warnings Args: channel: The channel to send the warning message in user: The user to give the warning to """


    data = datatools.get_data()
    server_id = channel.server.id

    if "warnings_max" not in data["discord"]["servers"][server_id][_data.modulename]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings_max"] = 3
    if "warnings" not in data["discord"]["servers"][server_id][_data.modulename]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"] = {}

    if user.id in data["discord"]["servers"][server_id][_data.modulename]["warnings"]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id] += 1
    else:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id] = 1

    datatools.write_data(data)

    warnings = data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id]
    max_warnings = data["discord"]["servers"][server_id][_data.modulename]["warnings_max"]

    await client.send_typing(channel)
    embed = ui_embed.user_warning(channel, user, warnings, max_warnings)
    await embed.send()

    if warnings >= max_warnings:
        await ban_user(channel, user)