Takes in a list of PDB lines and renumbers the atoms appropriately

def renumber_atoms(lines):
    '''
    Takes in a list of PDB lines and renumbers the atoms appropriately
    '''
    new_lines = []
    current_number = 1
    for line in lines:
        if line.startswith('ATOM') or line.startswith('HETATM'):
            new_lines.append(
                line[:6] + string.rjust('%d' % current_number, 5) + line[11:]
            )
            current_number += 1
        else:
            if line.startswith('TER'):
                current_number += 1
            new_lines.append(line)
    return new_lines