I like to remove elements base on the sub-element match.  

Example of `file.xml`: 

```
 <entry>
  <title>TEST1</title>
  <profile>
    <title>Default</title>
    <pid>
      <pidNumber>1880</pidNumber>
      <ContentType>PMT</ContentType>
      <isScrambled>0</isScrambled>
    </pid>
    <pid>
      <pidNumber>201</pidNumber>
      <ContentType>Video</ContentType>
      <isScrambled>0</isScrambled>
    </pid>
    <pid>
      <pidNumber>301</pidNumber>
      <ContentType>Audio</ContentType>
      <isScrambled>0</isScrambled>
    </pid>
    <pid>
      <pidNumber>302</pidNumber>
      <ContentType>Audio</ContentType>
      <isScrambled>0</isScrambled>
    </pid>
    <pid>
      <pidNumber>310</pidNumber>
      <ContentType>Audio</ContentType>
      <isScrambled>0</isScrambled>
    </pid>
  </profile>
</entry>

```

As you can see there lot of PIDS value (201,301,302-310) I want to remove all the pids that matches from 302-310. Here is my code, but I get error. 

```
# -*- coding: utf-8 -*-
import re
from xml.etree import ElementTree as ET

root = ET.parse("file.xml").getroot()
regex = r"[3][0-1][02-9]"
getpid = root.iter("pid")

for item in getpid:
    pidnum = item.find('.//pidNumber')
    pidnum = pidnum.text
    match = re.findall(regex, pidnum)
    match = ''.join(match)
    if pidnum == match:
        ET.dump(item)
        item.remove(getpid)

tree = ET(root)
tree.write("out.xml")

```

Error I get: 

> 
> self.\_children.remove(element)  
> 
>  ValueError: list.remove(x): x not in list`
> 
> 
> 

How to solve? I think I'm close.  

Thank you for viewing and help.