code: def packexpr(func, *properties):
      '''
      Store a evaluated value to specified property path. Often used in nstruct "prepack" parameter.
      
      :param func: a function which takes a NamedStruct as parameter and returns a value, often a lambda expression
      
      :param properties: specified field name, same as sizefromlen.
      
      :returns: a function which takes a NamedStruct as parameter, and store the return value of func to property path.
      '''
      def func2(namedstruct):
          v = namedstruct._target
          for p in properties[:-1]:
              v = getattr(v, p)
          setattr(v, properties[-1], func(namedstruct))
      return funcf packexpr(func, *properties):
      '''
      Store a evaluated value to specified property path. Often used in nstruct "prepack" parameter.
      
      :param func: a function which takes a NamedStruct as parameter and returns a value, often a lambda expression
      
      :param properties: specified field name, same as sizefromlen.
      
      :returns: a function which takes a NamedStruct as parameter, and store the return value of func to property path.
      '''
      def func2(namedstruct):
          v = namedstruct._target
          for p in properties[:-1]:
              v = getattr(v, p)
          setattr(v, properties[-1], func(namedstruct))
      return func2
docs: Store a evaluated value to specified property path. Often used in nstruct "prepack" parameter.
      
      :param func: a function which takes a NamedStruct as parameter and returns a value, often a lambda expression
      
      :param properties: specified field name, same as sizefromlen.
      
      :returns: a function which takes a NamedStruct as parameter, and store the return value of func to property path.