human
I wrote the below code

    @decorator
    def _open_file(func, *args, **kwargs):
        try:
            path = args[path_arg]
        except TypeError:
            try:
                path = kwargs[path_arg]
            except KeyError:
                msg = 'Missing    required    keyword    argument:    {0}'
                raise nx.NetworkXError(msg.format(path_arg))
            else:
                is_kwarg = True
        except IndexError:
            msg = 'path_arg    of    open_file    decorator    is    incorrect'
            raise nx.NetworkXError(msg)
        else:
            is_kwarg = False
        if is_string_like(path):
            ext = splitext(path)[1]
            fobj = _dispatch_dict[ext](path, mode=mode)
            close_fobj = True
        elif hasattr(path, 'read'):
            fobj = path
            close_fobj = False
        else:
            fobj = path
            close_fobj = False
        if is_kwarg:
            new_args = args
            kwargs[path_arg] = fobj
        else:
            new_args = list(args)
            new_args[path_arg] = fobj
        try:
            result = func(*new_args, **kwargs)
        finally:
            if close_fobj:
                fobj.close()
        return result
    return _open_file

What's a good function header?

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

def open_file(path_arg, mode='r'):