human
I wrote the below code

    primary_action_locator = (by.By.CSS_SELECTOR, 'td.actions_column    *.btn:nth-child(1)')
    secondary_actions_opener_locator = (by.By.CSS_SELECTOR, 'td.actions_column    >    .btn-group    >    *.btn:nth-child(2)')
    secondary_actions_locator = (by.By.CSS_SELECTOR, 'td.actions_column    >    .btn-group    >    ul.row_actions    >    li    >    a,    button')
    def decorator(method):
        @functools.wraps(method)
        def wrapper(table, row):
            def find_action(element):
                pattern = ('__action_%s' % action_name)
                return element.get_attribute('id').endswith(pattern)
            action_element = row._get_element(*primary_action_locator)
            if (not find_action(action_element)):
                action_element = None
                row._get_element(*secondary_actions_opener_locator).click()
                for element in row._get_elements(*secondary_actions_locator):
                    if find_action(element):
                        action_element = element
                        break
            if (action_element is None):
                msg = ("Could    not    bind    method    '%s'    to    action    control    '%s'" % (method.__name__, action_name))
                raise ValueError(msg)
            return method(table, action_element, row)
        return wrapper
    return decorator

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

def bind_row_action(action_name):