<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _mets_header(self, now):
 """ Return the metsHdr Element. """

        header_tag = etree.QName(utils.NAMESPACES[u"mets"], u"metsHdr")
        header_attrs = {}

        if self.createdate is None:
            header_attrs[u"CREATEDATE"] = now
        else:
            header_attrs[u"CREATEDATE"] = self.createdate
            header_attrs[u"LASTMODDATE"] = now

        header_element = etree.Element(header_tag, **header_attrs)
        for agent in self.agents:
            header_element.append(agent.serialize())
        for alternate_id in self.alternate_ids:
            header_element.append(alternate_id.serialize())

        return header_element