docs: def __write_srgb(self, outfile):
          """
          Write colour reference information: gamma, iccp etc.
  
          This method should be called only from ``write_idat`` method
          or chunk order will be ruined.
          """
          if self.rendering_intent is not None and self.icc_profile is not None:
              raise FormatError("sRGB(via rendering_intent) and iCCP could not"
                      "be present simultaneously")
          # http://www.w3.org/TR/PNG/#11sRGB
          if self.rendering_intent is not None:
              write_chunk(outfile, 'sRGB',
                          struct.pack("B", int(self.rendering_intent)))
          # http://www.w3.org/TR/PNG/#11cHRM
          if (self.white_point is not None and self.rgb_points is None) or\
                  (self.white_point is None and self.rgb_points is not None):
              logging.warn("White and RGB points should be both specified to"
                           " write cHRM chunk")
              self.white_point = None
              self.rgb_points = None
          if (self.white_point is not None and self.rgb_points is not None):
              data = (self.white_point[0], self.white_point[1],
                      self.rgb_points[0][0], self.rgb_points[0][1],
                      self.rgb_points[1][0], self.rgb_points[1][1],
                      self.rgb_points[2][0], self.rgb_points[2][1],
                      )
              write_chunk(outfile, 'cHRM',
                          struct.pack("!8L",
                                      *[int(round(it * 1e5)) for it in data]))
          # http://www.w3.org/TR/PNG/#11gAMA
          if self.gamma is not None:
              write_chunk(outfile, 'gAMA',
                          struct.pack("!L", int(round(self.gamma * 1e5))))
          # http://www.w3.org/TR/PNG/#11iCCP
          if self.icc_profile is not None:
              if self.compression is None or self.compression == -1:
                  comp_level = 6  # zlib.Z_DEFAULT_COMPRESSION
              else:
                  comp_level = self.compression
              write_chunk(outfile, 'iCCP',
                          self.icc_profile[0] + zerobyte +
                          zerobyte +
                          zlib.compress(self.icc_profile[1], comp_level))