def add_lines_at(self, anchor, *lines, **kwargs):
assert len(lines) > <NUM_LIT:0><EOL>replace = kwargs.pop('<STR_LIT:replace>', False)<EOL>after = kwargs.pop('<STR_LIT>', False)<EOL>assert not (after and replace)<EOL>assert not kwargs, "<STR_LIT>".format(kwargs.keys())<EOL>df_lines = self.lines<EOL>if isinstance(anchor, int):  <EOL><INDENT>assert anchor in range(len(df_lines))<EOL>if replace:<EOL><INDENT>del df_lines[anchor]<EOL><DEDENT><DEDENT>elif isinstance(anchor, dict):  <EOL><INDENT>assert anchor in self.structure, "<STR_LIT>".format(anchor)<EOL>if replace:<EOL><INDENT>df_lines[anchor['<STR_LIT>']:anchor['<STR_LIT>'] + <NUM_LIT:1>] = []<EOL><DEDENT>if after:<EOL><INDENT>anchor = anchor['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>anchor = anchor['<STR_LIT>']<EOL><DEDENT><DEDENT>elif isinstance(anchor, string_types):  <EOL><INDENT>matches = [index for index, text in enumerate(df_lines) if text == anchor]<EOL>if not matches:<EOL><INDENT>raise RuntimeError("<STR_LIT>" + anchor)<EOL><DEDENT>anchor = matches[-<NUM_LIT:1>]<EOL>if replace:<EOL><INDENT>del df_lines[anchor]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise RuntimeError("<STR_LIT>".format(anchor))<EOL><DEDENT>if after:<EOL><INDENT>df_lines[anchor] = _endline(df_lines[anchor])<EOL>anchor += <NUM_LIT:1><EOL><DEDENT>df_lines[anchor:anchor] = [_endline(line) for line in lines]<EOL>self.lines = df_lines<EOL>
Add lines at a specific location in the file.
:param anchor: structure_dict|line_str|line_num a reference to where adds should occur
:param lines: one or more lines to add to the content
:param replace: if True -- replace the anchor
:param after: if True -- insert after the anchor (conflicts with "replace")