code: def _make_serializer(meas, schema, rm_none, extra_tags, placeholder):
      _validate_schema(schema, placeholder)
      tags = []
      fields = []
      ts = None
      meas = meas
      for k, t in schema.items():
          if t is MEASUREMENT:
              meas = f"{{i.{k}}}"
          elif t is TIMEINT:
              ts = f"{{i.{k}}}"
          elif t is TIMESTR:
              if pd:
                  ts = f"{{pd.Timestamp(i.{k} or 0).value}}"
              else:
                  ts = f"{{dt_to_int(str_to_dt(i.{k}))}}"
          elif t is TIMEDT:
              if pd:
                  ts = f"{{pd.Timestamp(i.{k} or 0).value}}"
              else:
                  ts = f"{{dt_to_int(i.{k})}}"
          elif t is TAG:
              tags.append(f"{k}={{str(i.{k}).translate(tag_escape)}}")
          elif t is TAGENUM:
              tags.append(f"{k}={{getattr(i.{k}, 'name', i.{k} or None)}}")
          elif t in (FLOAT, BOOL):
              fields.append(f"{k}={{i.{k}}}")
          elif t is INT:
              fields.append(f"{k}={{i.{k}}}i")
          elif t is STR:
              fields.append(f"{k}=\\\"{{str(i.{k}).translate(str_escape)}}\\\"")
          elif t is ENUM:
              fields.append(f"{k}=\\\"{{getattr(i.{k}, 'name', i.{k} or None)}}\\\"")
          else:
              raise SchemaError(f"Invalid attribute type {k!r}: {t!r}")
      extra_tags = extra_tags or {}
      for k, v in extra_tags.items():
          tags.append(f"{k}={v}")
      if placeholder:
          fields.insert(0, f"_=true")
      sep = ',' if tags else ''
      ts = f' {ts}' if ts else ''
      fmt = f"{meas}{sep}{','.join(tags)} {','.join(fields)}{ts}"
      if rm_none:
          pat = r',\w+="?None"?i?'
          f = eval('lambda i: re.sub(r\'{}\', "", f"{}").encode()'.format(pat, fmt))
      else:
          f = eval('lambda i: f"{}".encode()'.format(fmt))
      f.__doc__ = "Returns InfluxDB line protocol representation of user-defined class"
      f._args = dict(meas=meas, schema=schema, rm_none=rm_none,
                     extra_tags=extra_tags, placeholder=placeholder)
      return f