def check_if_variable_used(methodNode, name):
    """Check if a variable with the given name is assigned in the given method"""
    for assignment in methodNode.find_all('assignment'):

        # if assignment has name node on the left side, compare the name of the variable with the given name
        if assignment.target.type == 'name' and assignment.target.value == name:
            return True

        # if assignment has tuple node on the left, check each entry
        if assignment.target.type == 'tuple' and assignment.target.find('name', value=name):
            return True

    return False