import re


def python_safe_name(s):
    """
    Return a name derived from string `s` safe to use as a Python function name.

    For example:
    >>> s = "not `\\a /`good` -safe name ??"
    >>> assert python_safe_name(s) == 'not_good_safe_name'
    """
    no_punctuation = re.compile(r"[\W_]", re.MULTILINE).sub
    s = s.lower()
    s = no_punctuation(" ", s)
    s = "_".join(s.split())
    return s