'Converts \'bad\' characters in a string to underscores
so they can be used as Ansible groups
>>> ForemanInventory.to_safe("foo-bar baz")
\'foo_barbaz\''

def to_safe(self, word):

    regex = '[^A-Za-z0-9\\_]'
    return re.sub(regex, '_', word.replace('    ', ''))
