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

def kill(container, rm=True):
    '''
    Kill a container

    Args:
        * container: Container name or ID
        * rm=True: Remove the container or not
    '''
    container = get_container(container)
    if not container:
        raise Exception('No such container: %s' % container)
    unbind_all(container['ip']) # legacy, only here for backwards compatibility

    sudo('docker kill %s' % container['name'])
    if rm:
        sudo('docker rm %s' % container['name'])