code: def binary(self):
          
          length = len(self.id) / 4
          if length == 0:
              return (
                  b_chr(_TAG_REFERENCE_EXT) +
                  self.node.binary() + self.id + self.creation
              )
          elif length <= 65535:
              creation_size = len(self.creation)
              if creation_size == 1:
                  return (
                      b_chr(_TAG_NEW_REFERENCE_EXT) +
                      struct.pack(b'>H', length) +
                      self.node.binary() + self.creation + self.id
                  )
              elif creation_size == 4:
                  return (
                      b_chr(_TAG_NEWER_REFERENCE_EXT) +
                      struct.pack(b'>H', length) +
                      self.node.binary() + self.creation + self.id
                  )
              else:
                  raise OutputException('unknown reference type')
          else:
              raise OutputException('uint16 overflow')
docs: return encoded representation