import re


def _sanitize_to_identifer(name):
    """ Changes a string with various characters into an identifier that is
        valid for python. i.e. 'minimum RR-interval' -> 'minimum_RR_interval'
        """
    n = name.strip()
    n = re.sub('/', ' ', n)
    n = re.sub('-', ' ', n)
    n = re.sub(' +', '_', n)
    n = re.sub('[\W]+', '', n)
    return n