code: def delete_module(modname, paranoid=None):
      
      from sys import modules
      try:
          thismod = modules[modname]
      except KeyError:
          raise ValueError(modname)
      these_symbols = dir(thismod)
      if paranoid:
          try:
              paranoid[:]  # sequence support
          except:
              raise ValueError('must supply a finite list for paranoid')
          else:
              these_symbols = paranoid[:]
      del modules[modname]
      for mod in modules.values():
          try:
              delattr(mod, modname)
          except AttributeError:
              pass
          if paranoid:
              for symbol in these_symbols:
                  if symbol[:2] == '__':  # ignore special symbols
                      continue
                  try:
                      delattr(mod, symbol)
                  except AttributeError:
                      pass
docs: Delete a module.http://stackoverflow.com/a/1668289
      :param modname:
      :param paranoid:
      :return: