env_replace.py
def _sort_by_length(key_value):
    """Sort key, value pairs to prioritize shortest substitution

    - prioritize long strings first to ensure the longest match is substituted
    - prioritize short variable names in case two keys have the same value
    """
    key, value = key_value
    return (-len(value), len(key))
Sort key, value pairs to prioritize shortest substitution

    - prioritize long strings first to ensure the longest match is substituted
    - prioritize short variable names in case two keys have the same value
    
Sort key, value pairs to prioritize shortest substitution
prioritize long strings first to ensure the longest match is substituted
prioritize short variable names in case two keys have the same value
Sort key value pairs to prioritize shortest substitution prioritize long strings first to ensure the longest match is substituted prioritize short variable names in case two keys have the same value
def _sort_by_length(key_value):
    key, value = key_value
    return (-len(value), len(key))
def _sort_by_length ( key_value ) : key , value = key_value return ( - len ( value ) , len ( key ) )
Sort key, value pairs to prioritize shortest substitution
 prioritize long strings first to ensure the longest match is substituted
 prioritize short variable names in case two keys have the same value
Sort key value pairs to prioritize shortest substitution prioritize long strings first to ensure the longest match is substituted prioritize short variable names in case two keys have the same value
"""Sort key, value pairs to prioritize shortest substitution

    - prioritize long strings first to ensure the longest match is substituted
    - prioritize short variable names in case two keys have the same value
    """
key_value