This would be more readable as a one-liner:
`predicate = inspect.isfunction if six.PY3 else inspect.ismethod`