def update_user_file_handle_limits():
    """
    Updates the max number of file handles the dynamite user can have open
    """
    new_output = ''
    limit_found = False
    for line in open('/etc/security/limits.conf').readlines():
        if line.startswith('dynamite'):
            new_output += 'dynamite    -   nofile   65535'
            limit_found = True
        else:
            new_output += line.strip()
        new_output += '\n'
    if not limit_found:
        new_output += '\ndynamite    -   nofile   65535\n'
    with open('/etc/security/limits.conf', 'w') as f:
        f.write(new_output)
