def resource_headers(self, jobscript):
        """Given a :class:`~clusterjob.JobScript` instance, return a list of
        lines that encode the resource requirements, to be added at the top of
        the rendered job script
        """
        lines = []
        for (key, val) in jobscript.resources.items():
            if key in self.resource_replacements:
                pbs_key = self.resource_replacements[key]
                if key == 'mem':
                    val = str(val) + "m"
            else:
                pbs_key = key
            if key in ['nodes', 'threads', 'ppn']:
                raise ResourcesNotSupportedError("The SGE scheduling system "
                        "uses 'parallel environments' to request resources "
                        "for parallelization. SgeBackend should be subclassed "
                        "for a specific cluster configuration in order to "
                        "encode 'nodes', 'threads', and 'ppn'.")
            if key in ['-cwd', 'cwd']:
                continue
            if val is None:
                continue
            if type(val) is bool:
                if val:
                    if not pbs_key.startswith('-'):
                        pbs_key = '-' + pbs_key
                    lines.append("%s %s" % (self.prefix, pbs_key))
            else:
                if not pbs_key.startswith('-'):
                    pbs_key = '-l %s=' % pbs_key
                if pbs_key.endswith('='):
                    lines.append('%s %s%s' % (self.prefix, pbs_key, str(val)))
                else:
                    lines.append('%s %s %s' % (self.prefix, pbs_key, str(val)))
        lines.append("%s -cwd" % self.prefix)
        return lines