docs: def get_nailing(expnum,ccd):
      """Get the 'nailing' images associated with expnum"""
      sql="""
      SELECT e.expnum, (e.mjdate - f.mjdate) dt
      FROM bucket.exposure e
      JOIN bucket.exposure f
      JOIN bucket.association b ON b.expnum=f.expnum
      JOIN bucket.association a ON a.pointing=b.pointing AND a.expnum=e.expnum
      WHERE f.expnum=%d
      AND abs(e.mjdate - f.mjdate) > 0.5
      AND abs(e.mjdate - f.mjdate) < 15.0
      ORDER BY abs(e.mjdate-f.mjdate)
      """ % ( expnum )
      try:
          import MOPdbaccess
          mysql=MOPdbaccess.connect('bucket','cfhls',dbSystem='MYSQL')
          bucket=mysql.cursor()
          bucket.execute(sql)
          nailings = bucket.fetchall()
          mysql.close()
          if int(ccd) < 18:
              cutout="[-*,-*]"
          else:
              cutout=None
          import MOPfits
          for nailing in nailings:
              filename=MOPfits.adGet(str(nailing[0])+opt.raw,extno=int(ccd),cutout=cutout)
      except:
          raise TaskError, "get nailing failed"