<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_zonefile_data( self, zonefile_hash, zonefile_dir ):
 """ Get a zonefile by hash Return the serialized zonefile on success Return None on error """

        # check cache
        atlas_zonefile_data = get_atlas_zonefile_data( zonefile_hash, zonefile_dir, check=False )
        if atlas_zonefile_data is not None:
            # check hash
            zfh = get_zonefile_data_hash( atlas_zonefile_data )
            if zfh != zonefile_hash:
                log.debug("Invalid local zonefile %s" % zonefile_hash )
                remove_atlas_zonefile_data( zonefile_hash, zonefile_dir )

            else:
                log.debug("Zonefile %s is local" % zonefile_hash)
                return atlas_zonefile_data

        return None