<Purpose>
    Disables a module and removes its commands from the seash commanddict.

  <Arguments>
    modulename: The module to disable.

  <Side Effects>
    All commands inside the specified module will be removed from the seash
    commanddict.

    A file (modulename.disabled) will be created under /modules/ indicating that
    this module has been disabled.

  <Exceptions>
    Exceptions raised by merge_commanddict()

  <Returns>
    None

def disable(commanddict, modulename):
  """
  <Purpose>
    Disables a module and removes its commands from the seash commanddict.

  <Arguments>
    modulename: The module to disable.

  <Side Effects>
    All commands inside the specified module will be removed from the seash
    commanddict.

    A file (modulename.disabled) will be created under /modules/ indicating that
    this module has been disabled.

  <Exceptions>
    Exceptions raised by merge_commanddict()

  <Returns>
    None
  """
  # Is this an installed module?
  if not modulename in module_data:
    raise seash_exceptions.UserError("Error, module '"+modulename+"' is not installed")
  
  # Is this module enabled?
  if not _is_module_enabled(modulename):
    raise seash_exceptions.UserError("Module is not enabled.")

  remove_commanddict(commanddict, module_data[modulename]['command_dict'])
  cleanup(modulename)

  # We mark this module as disabled by adding a modulename.disabled file.
  open(MODULES_FOLDER_PATH + os.sep + modulename + ".disabled", 'w')