I am trying to use the following script for restrain my secondary
structure:
Indentation is important in Python, but the script you show is not
indented properly, so won't work. Your mail client may have stripped the
indentation. It's better to attach this sort of thing rather than try to
paste it into your email.