parameters: (self, fp, sep='\n')
return_statement: return n
docstring: Read all messages from the queue and persist them to file-like object.
          Messages are written to the file and the 'sep' string is written
          in between messages.  Messages are deleted from the queue after
          being written to the file.
          Returns the number of messages saved.
docstring_summary: Read all messages from the queue and persist them to file-like object.
          Messages are written to the file and the 'sep' string is written
          in between messages.  Messages are deleted from the queue after
          being written to the file.
          Returns the number of messages saved.
docstring_tokens: Read all messages from the queue and persist them to file - like object . Messages are written to the file and the sep string is written in between messages . Messages are deleted from the queue after being written to the file . Returns the number of messages saved .
function: def save_to_file(self, fp, sep='\n'):
          """
          Read all messages from the queue and persist them to file-like object.
          Messages are written to the file and the 'sep' string is written
          in between messages.  Messages are deleted from the queue after
          being written to the file.
          Returns the number of messages saved.
          """
          n = 0
          m = self.read()
          while m:
              n += 1
              fp.write(m.get_body())
              if sep:
                  fp.write(sep)
              self.delete_message(m)
              m = self.read()
          return n
function_tokens: def save_to_file ( self , fp , sep = '\n' ) : n = 0 m = self . read ( ) while m : n += 1 fp . write ( m . get_body ( ) ) if sep : fp . write ( sep ) self . delete_message ( m ) m = self . read ( ) return n