code: def parse_label(module = None, function = None, offset = None):
          
  
          # TODO
          # Invalid characters should be escaped or filtered.
  
          # Convert ordinals to strings.
          try:
              function = "#0x%x" % function
          except TypeError:
              pass
  
          # Validate the parameters.
          if module is not None and ('!' in module or '+' in module):
              raise ValueError("Invalid module name: %s" % module)
          if function is not None and ('!' in function or '+' in function):
              raise ValueError("Invalid function name: %s" % function)
  
          # Parse the label.
          if module:
              if function:
                  if offset:
                      label = "%s!%s+0x%x" % (module, function, offset)
                  else:
                      label = "%s!%s" % (module, function)
              else:
                  if offset:
  ##                    label = "%s+0x%x!" % (module, offset)
                      label = "%s!0x%x" % (module, offset)
                  else:
                      label = "%s!" % module
          else:
              if function:
                  if offset:
                      label = "!%s+0x%x" % (function, offset)
                  else:
                      label = "!%s" % function
              else:
                  if offset:
                      label = "0x%x" % offset
                  else:
                      label = "0x0"
  
          return label
docs: Creates a label from a module and a function name, plus an offset.
  
          @warning: This method only creates the label, it doesn't make sure the
              label actually points to a valid memory location.
  
          @type  module: None or str
          @param module: (Optional) Module name.
  
          @type  function: None, str or int
          @param function: (Optional) Function name or ordinal.
  
          @type  offset: None or int
          @param offset: (Optional) Offset value.
  
              If C{function} is specified, offset from the function.
  
              If C{function} is C{None}, offset from the module.
  
          @rtype:  str
          @return:
              Label representing the given function in the given module.
  
          @raise ValueError:
              The module or function name contain invalid characters.