def cut_and_paste_segment(seq, start, end, new_start):
    """Move a subsequence by "diff" nucleotides the left or the right."""
    sub = seq[start:end]
    diff = new_start - start
    if diff > 0:
        return seq[:start] + seq[end : end + diff] + sub + seq[end + diff :]
    else:
        return seq[: start + diff] + sub + seq[start + diff : start] + seq[end:]