human
Here's a good function header given the following:
I wrote the below code

    if (regex.groups == 0):
        raise ValueError('pattern    contains    no    capture    groups')
    empty_row = ([np.nan] * regex.groups)
    def f(x):
        if (not isinstance(x, compat.string_types)):
            return empty_row
        m = regex.search(x)
        if m:
            return [(np.nan if (item is None) else item) for item in m.groups()]
        else:
            return empty_row
    return f

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

def _groups_or_na_fun(regex):