def _serialize(self, convert_to_key_and_value, ignore_missing=False):
serialized = {}<EOL>properties = self._get_property_names(self)<EOL>def get_property_detail(name):<EOL><INDENT>p = [p for p in self._property_details if p.name == name]<EOL>return None if len(p) == <NUM_LIT:0> else p[<NUM_LIT:0>]<EOL><DEDENT>for p in properties:<EOL><INDENT>pd = get_property_detail(p)<EOL>value = self._property_to_field(p, pd)<EOL>field_name = p if not pd else pd.to_field_name()<EOL>if value is None or (ignore_missing and not value) or (pd and pd.unsent):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>key, value = convert_to_key_and_value(field_name, value, pd)<EOL>if key:<EOL><INDENT>serialized[key] = value<EOL><DEDENT><DEDENT><DEDENT>return serialized<EOL>
serialize model object to dictionary
:param convert_to_key_and_value: function(field_name, value, property_detail) -> key, value
:return: