parameters: (new_token, token)
docstring: Insert new_token before token.
  
    Args:
      new_token: A token to be added to the stream
      token: A token already in the stream
docstring_summary: Insert new_token before token.
docstring_tokens: Insert new_token before token .
function: def InsertTokenBefore(new_token, token):
    """Insert new_token before token.
  
    Args:
      new_token: A token to be added to the stream
      token: A token already in the stream
    """
    new_token.next = token
    new_token.previous = token.previous
  
    new_token.metadata = copy.copy(token.metadata)
  
    if new_token.IsCode():
      old_last_code = token.metadata.last_code
      following_token = token
      while (following_token and
             following_token.metadata.last_code == old_last_code):
        following_token.metadata.last_code = new_token
        following_token = following_token.next
  
    token.previous = new_token
    if new_token.previous:
      new_token.previous.next = new_token
  
    if new_token.start_index is None:
      if new_token.line_number == token.line_number:
        new_token.start_index = token.start_index
      else:
        previous_token = new_token.previous
        if previous_token:
          new_token.start_index = (previous_token.start_index +
                                   len(previous_token.string))
        else:
          new_token.start_index = 0
  
      iterator = new_token.next
      while iterator and iterator.line_number == new_token.line_number:
        iterator.start_index += len(new_token.string)
        iterator = iterator.next
function_tokens: def InsertTokenBefore ( new_token , token ) : new_token . next = token new_token . previous = token . previous new_token . metadata = copy . copy ( token . metadata ) if new_token . IsCode ( ) : old_last_code = token . metadata . last_code following_token = token while ( following_token and following_token . metadata . last_code == old_last_code ) : following_token . metadata . last_code = new_token following_token = following_token . next token . previous = new_token if new_token . previous : new_token . previous . next = new_token if new_token . start_index is None : if new_token . line_number == token . line_number : new_token . start_index = token . start_index else : previous_token = new_token . previous if previous_token : new_token . start_index = ( previous_token . start_index + len ( previous_token . string ) ) else : new_token . start_index = 0 iterator = new_token . next while iterator and iterator . line_number == new_token . line_number : iterator . start_index += len ( new_token . string ) iterator = iterator . next