def _remove_at_charset(tokens):
 tokens = iter(tokens)
 header = list(islice(tokens, 4))
 if ([t.type for t in header] == [u'ATKEYWORD', u'S', u'STRING', u';']):
  (atkw, space, string, semicolon) = header
  if (((atkw.value, space.value) == (u'@charset', u' ')) and (string.as_css()[0] == u'"')):
   return tokens
 return chain(header, tokens)

def _remove_at_charset ( tokens ) : tokens = iter ( tokens ) header = list ( islice ( tokens , 4 ) ) if ( [ t . type for t in header ] == [ u'ATKEYWORD' , u'S' , u'STRING' , u';' ] ) : ( atkw , space , string , semicolon ) = header if ( ( ( atkw . value , space . value ) == ( u'@charset' , u' ' ) ) and ( string . as_css ( ) [ 0 ] == u'"' ) ) : return tokens return chain ( header , tokens )
remove any valid @charset at the beggining of a token stream .