def get_start_end(sequence, skiplist=('-', '?')):
 length = len(sequence)
 if (length == 0):
  return (None, None)
 end = (length - 1)
 while ((end >= 0) and (sequence[end] in skiplist)):
  end -= 1
 start = 0
 while ((start < length) and (sequence[start] in skiplist)):
  start += 1
 if ((start == length) and (end == (-1))):
  return ((-1), (-1))
 else:
  return (start, end)

def get_start_end ( sequence , skiplist = ( '-' , '?' ) ) : length = len ( sequence ) if ( length == 0 ) : return ( None , None ) end = ( length - 1 ) while ( ( end >= 0 ) and ( sequence [ end ] in skiplist ) ) : end -= 1 start = 0 while ( ( start < length ) and ( sequence [ start ] in skiplist ) ) : start += 1 if ( ( start == length ) and ( end == ( - 1 ) ) ) : return ( ( - 1 ) , ( - 1 ) ) else : return ( start , end )
return position of first and last character which is not in skiplist .