def parse_args(self):
        
        """ Callback function called by argument parser.
        Helps to remove duplicate code """

        if len(sys.argv)<2:
            sys.argv.append('-h')
            
        parser = optparse.OptionParser(usage=INTRO)
        parser.add_option('-o','--output',dest='outfile',help='Direct output to file OUTFILE',metavar='OUTFILE')
        parser.add_option('-f','--font',dest='font',help='Use Postscript font FONT (must be in standard 14, default: Courier)',
                          default='Courier')
        parser.add_option('-I','--isolatin',dest='isolatin',help='Use ISO latin-1 encoding',default=False,action='store_true')
        parser.add_option('-s','--size',dest='fontsize',help='Use font at PTSIZE points (default=>10)',metavar='PTSIZE',default=10)
        parser.add_option('-v','--linespace',dest='linespace',help='Use line spacing LINESPACE (deault 12)',metavar='LINESPACE',default=12)
        parser.add_option('-l','--lines',dest='lines',help='Lines per page (default 60, determined automatically if unspecified)',default=60, metavar=None)
        parser.add_option('-c','--chars',dest='chars',help='Maximum characters per line (default 80)',default=80,metavar=None)
        parser.add_option('-t','--tab',dest='tabspace',help='Spaces per tab character (default 4)',default=4,metavar=None)
        parser.add_option('-F','--ignoreff',dest='formfeed',help='Ignore formfeed character ^L (i.e, accept formfeed characters as pagebreaks)',default=False,action='store_true')
        parser.add_option('-P','--papersize',dest='papersize',help='Set paper size (default is letter, accepted values are "A4" or "A3")')
        parser.add_option('-W','--width',dest='width',help='Independent paper width in points',metavar=None,default=612)
        parser.add_option('-H','--height',dest='height',help='Independent paper height in points',metavar=None,default=792)
        parser.add_option('-2','--twocolumns',dest='twocolumns',help='Format as two columns',metavar=None,default=False,action='store_true')
        parser.add_option('-L','--landscape',dest='landscape',help='Format in landscape mode',metavar=None,default=False,action='store_true')
        parser.add_option('-R','--regexp',dest='pageregexp',help='Regular expression string to determine page breaks (if supplied, this will be used to split text into pages, instead of using line count)',metavar=None)
        parser.add_option('-S','--subject',dest='subject',help='Optional subject for the document',metavar=None)
        parser.add_option('-A','--author',dest='author',help='Optional author for the document',metavar=None)
        parser.add_option('-K','--keywords',dest='keywords',help='Optional list of keywords for the document (separated by commas)',metavar=None)
        

        optlist, args = parser.parse_args()
        # print optlist.__dict__, args

        if len(args)==0:
            sys.exit('Error: input file argument missing')
        elif len(args)>1:
            sys.exit('Error: Too many arguments')            

        self._ifile = args[0]
        
        d = optlist.__dict__
        if d.get('isolatin'): self._IsoEnc=True
        if d.get('formfeed'): self._doFFs = True
        if d.get('twocolumns'): self._columns = 2
        if d.get('landscape'): self._landscape = True

        self._font = '/' + d.get('font')
        psize = d.get('papersize')
        if psize=='A4':
            self._pageWd=595
            self._pageHt=842
        elif psize=='A3':
            self._pageWd=842
            self._pageHt=1190

        fsize = int(d.get('fontsize'))
        if fsize < 1: fsize = 1
        self._ptSize = fsize

        lspace = int(d.get('linespace'))
        if lspace<1: lspace = 1
        self._vertSpace = lspace

        lines = int(d.get('lines'))
        if lines<1: lines = 1
        self._lines = int(lines)

        chars = int(d.get('chars'))
        if chars<4: chars = 4
        self._cols = chars

        tab = int(d.get('tabspace'))
        if tab<1: tab = 1
        self._tab = tab

        w = int(d.get('width'))
        if w<72: w=72
        self._pageWd = w

        h = int(d.get('height'))
        if h<72: h=72
        self._pageHt = h

        # Very optional args
        author = d.get('author')
        if author: self._author = author

        subject = d.get('subject')
        if subject: self._subject = subject

        keywords = d.get('keywords')
        if keywords:
            self._keywords = keywords.split(',')

        pagebreak = d.get('pageregexp')
        if pagebreak:
            self._pagebreakre = re.compile(pagebreak, re.UNICODE|re.IGNORECASE)
        
        outfile = d.get('outfile')
        if outfile: self._ofile = outfile
        
        if self._landscape:
            print 'Landscape option on...'
        if self._columns==2:
            print 'Printing in two columns...'
        if self._doFFs:
            print 'Ignoring form feed character...'
        if self._IsoEnc:
            print 'Using ISO Latin Encoding...'

        print 'Using font',self._font[1:],'size =', self._ptSize
 Callback function called by argument parser.
        Helps to remove duplicate code 
recipes/Python/532908_Text_to_PDF_Converter_rewrite/recipe-532908.py