Replace the tabs in 's' and keep its original alignment with the tab-stop
    equals to 'ts'

def _replace_tabs(s, ts=8):
    """
    Replace the tabs in 's' and keep its original alignment with the tab-stop
    equals to 'ts'
    """
    result = ''
    for c in s:
        if c == '\t':
            while True:
                result += ' '
                if len(result) % ts == 0:
                    break
        else:
            result += c
    return result