human
I wrote the below code

    if (hb_info is None):
        hb_info = HBInfo.from_data(m)
    def _set_matrix(fid):
        hb = HBFile(fid, hb_info)
        return hb.write_matrix(m)
    if hasattr(path_or_open_file, 'write'):
        return _set_matrix(path_or_open_file)
    else:
        with open(path_or_open_file, 'w') as f:
            return _set_matrix(f)

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

def hb_write(path_or_open_file, m, hb_info=None):