title: Problem in Python with function only writing one line to file
body: <p>I am trying to write a function in Python 3 that will write all lines that end with the string 'halloween' to a file. When I call this function, I can only get one line to write to the output file (file_2.txt). Can anyone point out where my problem is? Thanks in advance. </p>
  
  <pre><code>def parser(reader_o, infile_object, outfile_object):
      for line in reader_o:
          if line.endswith('halloween'):
              return(line)
  
  with open("file_1.txt", "r") as file_input:
      reader = file_input.readlines()
      with open("file_2.txt", "w") as file_output:
          file_output.write(parser(reader))
  </code></pre>