def format_unix_var(text):
    """
    Example::

        this_is_very_good
    """
    text = text.strip()
    if len(text) == 0:  # if empty string, return it
        raise ValueError("can not be empty string!")
    else:
        if text[0] in string.digits:
            raise ValueError("variable can not start with digits!")
        text = text.lower()
        # delete redundant empty space
        words = list()
        word = list()
        for char in text:
            if char in ALPHA_DIGITS:
                word.append(char)
            else:
                if len(word):
                    words.append("".join(word))
                    word = list()
        if len(word):
            words.append("".join(word))

        return "_".join(words)
def format_unix_var ( text ) : text = text . strip ( ) if len ( text ) == 0 : raise ValueError ( "can not be empty string!" ) else : if text [ 0 ] in string . digits : raise ValueError ( "variable can not start with digits!" ) text = text . lower ( ) words = list ( ) word = list ( ) for char in text : if char in ALPHA_DIGITS : word . append ( char ) else : if len ( word ) : words . append ( "" . join ( word ) ) word = list ( ) if len ( word ) : words . append ( "" . join ( word ) ) return "_" . join ( words )
Example::

        this_is_very_good