I want to edit a very long file in python after the first ocurrence of a heading. The file looks something like this:

```
*First Heading
line1
line2
line3
line4
*Second Heading
line1
line2
line3
line4
*Third Heading 
line1
line2
line3
...
...
more headings and many more lines

```

I want to replace (for example) the line2 of the Second Heading, for something like this:

```
someNewtext line2

```

I can do this very efficiently with sed using something like this:

```
sed -e -i '/\*Second\ Heading/,/\*Third\ Heading/s/line2/someNewText\ line2/' file.txt 

```

Can I do something similar in Python in an efficient manner?