human
I wrote the below code

    def _get_namespace_public_id(obj):
        return (namespace_public_id or obj.namespace.public_id)
    def _format_participant_data(participant):
        'Event.participants    is    a    JSON    blob    which    may    contain    internal    data.\n                                This    function    returns    a    dict    with    only    the    data    we    want    to    make\n                                public.'
        dct = {}
        for attribute in ['name', 'status', 'email', 'comment']:
            dct[attribute] = participant.get(attribute)
        return dct
    def _get_lowercase_class_name(obj):
        return type(obj).__name__.lower()
    if isinstance(obj, datetime.datetime):
        return calendar.timegm(obj.utctimetuple())
    if isinstance(obj, datetime.date):
        return obj.isoformat()
    if isinstance(obj, arrow.arrow.Arrow):
        return encode(obj.datetime)
    if isinstance(obj, Namespace):
        acc_state = obj.account.sync_state
        if (acc_state is None):
            acc_state = 'running'
        if (is_n1 and (acc_state not in ['running', 'invalid'])):
            acc_state = 'running'
        resp = {'id': obj.public_id, 'object': 'account', 'account_id': obj.public_id, 'email_address': (obj.account.email_address if obj.account else ''), 'name': obj.account.name, 'provider': obj.account.provider, 'organization_unit': obj.account.category_type, 'sync_state': acc_state}
        if (expand and obj.account.server_settings):
            resp['server_settings'] = obj.account.server_settings
        return resp
    elif isinstance(obj, Account):
        raise Exception('Should    never    be    serializing    accounts')
    elif isinstance(obj, Message):
        thread_public_id = None
        if obj.thread:
            thread_public_id = obj.thread.public_id
        resp = {'id': obj.public_id, 'object': 'message', 'account_id': _get_namespace_public_id(obj), 'subject': obj.subject, 'from': format_address_list(obj.from_addr), 'reply_to':...

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def _encode(obj, namespace_public_id=None, expand=False, is_n1=False):