<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 This notebook will help you install the SAS NBExtensions
The process includes a mix of command line and python code and can be done either systemwide or for the current user depending on the permission level the user has.
This code will import the notebook module and display the paths that Juypter will search for NBExtensions
Step1:  To Install Systemwide
This will require you to be root or have sudo rights
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either
Step2:  This python code will check on the nbextension in systemwide folders (user=False is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
Step3:  To install for the Current User
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either
Step4:  This python code will check on the nbextension in user folders ~/ (user=True is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
Step7:  Check to see what NBExtensions are Installed
This code will produce a simple table listing the installed extensions this user has access to. It will be a mix of user and systemwide extensions if applicable.
Is should list at least the following
<ASSISTANT_TASK:>
Python Code:
import notebook
from __future__ import print_function
from jupyter_core.paths import jupyter_data_dir, jupyter_path
print(jupyter_data_dir())
print(jupyter_path())
Explanation: This notebook will help you install the SAS NBExtensions
The process includes a mix of command line and python code and can be done either systemwide or for the current user depending on the permission level the user has.
This code will import the notebook module and display the paths that Juypter will search for NBExtensions
End of explanation
! sudo jupyter nbextension install sas_kernel/sas_kernel/nbextensions/showSASLog
Explanation: To Install Systemwide
This will require you to be root or have sudo rights
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either:
1. change the path below
1. use the ! to change the current working directory
If this command is successful you should see a note about files being copied from the sas_kernel location to /usr/local/share/jupyter/nbextensions/
End of explanation
if notebook.nbextensions.check_nbextension('showSASLog', user=False):
    E = notebook.nbextensions.EnableNBExtensionApp()
    E.enable_nbextension('showSASLog/main')
else:
    print ("Extension not found")
! sudo jupyter nbextension install /root/sas_kernel/sas_kernel/nbextensions/theme
if notebook.nbextensions.check_nbextension('theme', user=False):
    E = notebook.nbextensions.EnableNBExtensionApp()
    E.enable_nbextension('theme/theme_selector')
else:
    print ("Extension not found")
Explanation: This python code will check on the nbextension in systemwide folders (user=False is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
End of explanation
! jupyter nbextension install sas_kernel/sas_kernel/nbextensions/showSASLog --user
Explanation: To install for the Current User
The ! below is a "magic" that runs os commands. The command below assumes your cuurent working directory is inside the sas_kernel cloned repository. If that is not the case then you can either:
1. change the path below
1. use the ! to change the current working directory
If this command is successful you should see a note about files being copied from the sas_kernel location to /usr/local/share/jupyter/nbextensions/
End of explanation
if notebook.nbextensions.check_nbextension('showSASLog', user=True):
    E = notebook.nbextensions.EnableNBExtensionApp()
    E.enable_nbextension('showSASLog/main')
else:
    print ("Extension not found")
! jupyter nbextension install /root/sas_kernel/sas_kernel/nbextensions/theme --user
if notebook.nbextensions.check_nbextension('theme', user=True):
    E = notebook.nbextensions.EnableNBExtensionApp()
    E.enable_nbextension('theme/theme_selector')
else:
    print ("Extension not found")
Explanation: This python code will check on the nbextension in user folders ~/ (user=True is the flag for this)
and then enable the extension. If anything goes wrong, you'll see the Extension not found message
End of explanation
from notebook.services.config import ConfigManager
from IPython.display import HTML
ip = get_ipython()
cm = ConfigManager(parent=ip, profile_dir=ip.profile_dir.location)
extensions =cm.get('notebook')
table = ""
for ext in extensions['load_extensions']:
    table += "<tr><td>%s</td>\n" % (ext)
top = 
<table border="1">
  <tr>
    <th>Extension name</th>
  </tr>
bottom = 
</table>
HTML(top + table + bottom)
Explanation: Check to see what NBExtensions are Installed
This code will produce a simple table listing the installed extensions this user has access to. It will be a mix of user and systemwide extensions if applicable.
Is should list at least the following:
|Extension name|
|---|
|showSASLog/main|
|theme/theme_selector|
End of explanation
<END_TASK>