code: def _GetDiscoveryDocFromFlags(args):
      
      if args.discovery_url:
          try:
              return util.FetchDiscoveryDoc(args.discovery_url)
          except exceptions.CommunicationError:
              raise exceptions.GeneratedClientError(
                  'Could not fetch discovery doc')
  
      infile = os.path.expanduser(args.infile) or '/dev/stdin'
      with io.open(infile, encoding='utf8') as f:
          return json.loads(util.ReplaceHomoglyphs(f.read()))
docs: Get the discovery doc from flags.