code: def query_dqsegdb(cls, flag, *args, **kwargs):
          
          # parse arguments
          qsegs = _parse_query_segments(args, cls.query_dqsegdb)
  
          # get server
          url = kwargs.pop('url', DEFAULT_SEGMENT_SERVER)
  
          # parse flag
          out = cls(name=flag)
          if out.ifo is None or out.tag is None:
              raise ValueError("Cannot parse ifo or tag (name) for flag %r"
                               % flag)
  
          # process query
          for start, end in qsegs:
              # handle infinities
              if float(end) == +inf:
                  end = to_gps('now').seconds
  
              # query
              try:
                  data = query_segments(flag, int(start), int(end), host=url)
              except HTTPError as exc:
                  if exc.code == 404:  # if not found, annotate flag name
                      exc.msg += ' [{0}]'.format(flag)
                  raise
  
              # read from json buffer
              new = cls.read(
                  BytesIO(json.dumps(data).encode('utf-8')),
                  format='json',
              )
  
              # restrict to query segments
              segl = SegmentList([Segment(start, end)])
              new.known &= segl
              new.active &= segl
              out += new
              # replace metadata
              out.description = new.description
              out.isgood = new.isgood
  
          return out
docs: Query the advanced LIGO DQSegDB for the given flag
  
          Parameters
          ----------
          flag : `str`
              The name of the flag for which to query
  
          *args
              Either, two `float`-like numbers indicating the
              GPS [start, stop) interval, or a `SegmentList`
              defining a number of summary segments
  
          url : `str`, optional
              URL of the segment database, defaults to
              ``$DEFAULT_SEGMENT_SERVER`` environment variable, or
              ``'https://segments.ligo.org'``
  
          Returns
          -------
          flag : `DataQualityFlag`
              A new `DataQualityFlag`, with the `known` and `active` lists
              filled appropriately.