def del_by_key(data, delete):
 data = list(data)
 for (idx, item) in enumerate(data):
  if ((isinstance(item[0], basestring) and (item[0] == delete)) or (isinstance(item[0], (list, tuple)) and (item[0] in delete))):
   del data[idx]
 return data

def del_by_key ( data , delete ) : data = list ( data ) for ( idx , item ) in enumerate ( data ) : if ( ( isinstance ( item [ 0 ] , basestring ) and ( item [ 0 ] == delete ) ) or ( isinstance ( item [ 0 ] , ( list , tuple ) ) and ( item [ 0 ] in delete ) ) ) : del data [ idx ] return data
delete a tuple from a list of tuples based on its first item .