class Foo(Buffer):
            a = be_int_field(where=bytes_ref[0:1])
            s = str_field(where=bytes_ref[1:1 +
                                          num_ref(self_ref.calc_s_size(a))])

            def calc_s_size(self, a):
                return a * 2
 class CoolingElementInfo(Buffer):
     byte_size = 3
     # for real fan speed the fan speed value should be multiplied by a factor of 10
     fan_speed = int_field(where=(bytes_ref[0].bits[0:3] +
                                  bytes_ref[1]))
     ident = be_int_field(where=bytes_ref[0].bits[7])
     speed_code = be_int_field(where=bytes_ref[2].bits[0:3])
     off = be_int_field(where=bytes_ref[2].bits[4])
     reqstd_on = be_int_field(where=bytes_ref[2].bits[5])
     fail = be_int_field(where=bytes_ref[2].bits[6])
     hot_swap = be_int_field(where=bytes_ref[2].bits[7])
 class Foo(Buffer):
     s = str_field(where=bytes_ref[2:2 + num_ref(self_ref.a)])
     a = be_int_field(where=bytes_ref[0:2], set_before_pack=len_ref(s))
 class Foo(Buffer):
     a = be_int_field(where=bytes_ref[0:2])
     b = str_field(where=bytes_ref[2:2 + num_ref(self_ref.a)])
 class Foo(Buffer):
     l = be_int_field(where=bytes_ref[0:2],
                      set_before_pack=len_ref(self_ref.s))
     s = str_field(where=bytes_ref[2:2 + l])
 class Foo(Buffer):
     l = be_int_field(where=bytes_ref[0:2])
     s = str_field(where_when_pack=bytes_ref[2:],
                   where_when_unpack=bytes_ref[2:l + 4])
 class Foo(Buffer):
     l = be_int_field(where=bytes_ref[0])
 class SasExpanderElementInfo(Buffer):
     byte_size = 3
     fail = be_int_field(where=bytes_ref[0].bits[6])
     ident = be_int_field(where=bytes_ref[0].bits[7])