def user_warning(channel, user, warnings, max_warnings):
    """
    Creates an embed UI containing an user warning message

    Args:
        channel (discord.Channel): The Discord channel to bind the embed to
        user (discord.User): The user to warn
        warnings (str): The warnings for the user
        max_warnings (str): The maximum warnings for the user

    Returns:
        ui (ui_embed.UI): The embed UI object
    """

    username = user.name
    if isinstance(user, discord.Member):
        if user.nick is not None:
            username = user.nick

    warning_count_text = "warnings" if warnings != 1 else "warning"
    warning_text = "{} {}".format(warnings, warning_count_text)
    result_text = "at {} you will be banned".format(max_warnings)
    if warnings >= max_warnings:
        result_text = "you are being banned because you have more than the maximum warnings"

    # Create embed UI object
    gui = ui_embed.UI(
        channel,
        "Warning {}".format(username),
        "You now have {} {}, {}".format(warning_text, username, result_text),
        modulename=modulename
    )

    return gui