code: def numberify_file(self, filename):
          '''Prepend each line of a file with the line number
          Argument:
          filename - name of the file to be numberified
          '''
          try:
              fd = open(filename, 'r+')
              lines = fd.readlines()
              for i in range(len(lines)):
                  if lines[i][0:len(str(i+1))] != str(i+1):
                      lines[i] = str(i+1) + ' ' + lines[i]
                  else:
                      print "File already numbered"
                      return False
              fd.seek(0)
              fd.writelines(lines)
              fd.close()
              return True
          except IOError as e:
              print 'I/O error({0}): {1}'.format(e.errno, e.strerror)
          except:
              print 'Unexpected error:', exc_info()[0]
              raisf numberify_file(self, filename):
          '''Prepend each line of a file with the line number
          Argument:
          filename - name of the file to be numberified
          '''
          try:
              fd = open(filename, 'r+')
              lines = fd.readlines()
              for i in range(len(lines)):
                  if lines[i][0:len(str(i+1))] != str(i+1):
                      lines[i] = str(i+1) + ' ' + lines[i]
                  else:
                      print "File already numbered"
                      return False
              fd.seek(0)
              fd.writelines(lines)
              fd.close()
              return True
          except IOError as e:
              print 'I/O error({0}): {1}'.format(e.errno, e.strerror)
          except:
              print 'Unexpected error:', exc_info()[0]
              raise
docs: Prepend each line of a file with the line number
          Argument:
          filename - name of the file to be numberified