docs: def encode(self, value):
          """Encodes the given value according to this FieldDefinition."""
          if type(value) == str and self.enum and value in self.enum:
              value = self.enum[value]
  
          if type(value) == int:
              if self.shift > 0:
                  value <<= self.shift
              if self.mask is not None:
                  value &= self.mask
  
          return self.type.encode(value) if self.type else bytearray()