human
I wrote the below code

    ensure_lapack()
    _check_linalg_1_or_2d_matrix(a, 'matrix_rank')
    def _2d_matrix_rank_impl(a, tol):
        if (tol in (None, types.none)):
            nb_type = getattr(a.dtype, 'underlying_float', a.dtype)
            np_type = np_support.as_dtype(nb_type)
            eps_val = np.finfo(np_type).eps
            def _2d_tol_none_impl(a, tol=None):
                s = _compute_singular_values(a)
                r = a.shape[0]
                c = a.shape[1]
                l = max(r, c)
                t = ((s[0] * l) * eps_val)
                return _get_rank_from_singular_values(s, t)
            return _2d_tol_none_impl
        else:
            def _2d_tol_not_none_impl(a, tol):
                s = _compute_singular_values(a)
                return _get_rank_from_singular_values(s, tol)
            return _2d_tol_not_none_impl
    def _get_matrix_rank_impl(a, tol):
        ndim = a.ndim
        if (ndim == 1):
            def _1d_matrix_rank_impl(a, tol):
                for k in range(len(a)):
                    if (a[k] != 0.0):
                        return 1
                return 0
            return _1d_matrix_rank_impl
        elif (ndim == 2):
            return _2d_matrix_rank_impl(a, tol)
        else:
            assert 0
    return _get_matrix_rank_impl(a, tol)

What's a good function header?

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

@overload(np.linalg.matrix_rank)
def matrix_rank_impl(a, tol=None):