code: def pull(args):
      
      p = OptionParser(pull.__doc__)
      p.set_db_opts(dbname="mtg2", credentials=None)
      p.add_option("--frag", default=False, action="store_true",
              help="The command to pull sequences from db [default: %default]")
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      libfile, = args
  
      dbname = opts.dbname
      frag = opts.frag
      fp = open(libfile)
      hostname, username, password = get_profile()
  
      for row in fp:
          lib_id, name = row.split("|", 1)
          sqlfile = lib_id + ".sql"
  
          if not op.exists(sqlfile):
              fw = open(sqlfile, "w")
              print("select seq_name from sequence where seq_name like" + \
                      " '{0}%' and trash is null".format(lib_id), file=fw)
              fw.close()
  
          if frag:
              cmd = "pullfrag -D {0} -n {1}.sql -o {1} -q -S {2}".format(dbname, lib_id, hostname)
              cmd += " -U {0} -P {1}".format(username, password)
          else:
              cmd = "pullseq -D {0} -n {1}.sql -o {1} -q".format(dbname, lib_id)
          sh(cmd)
docs: %prog pull libfile
  
      Pull the sequences using the first column in the libfile.