def write_pid_file(self, overwrite=False):
pid_file = os.path.join(self.profile_dir.pid_dir, self.name + u'<STR_LIT>')<EOL>if os.path.isfile(pid_file):<EOL><INDENT>pid = self.get_pid_from_file()<EOL>if not overwrite:<EOL><INDENT>raise PIDFileError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' % (pid_file, pid)<EOL>)<EOL><DEDENT><DEDENT>with open(pid_file, '<STR_LIT:w>') as f:<EOL><INDENT>self.log.info("<STR_LIT>" % pid_file)<EOL>f.write(repr(os.getpid())+'<STR_LIT:\n>')<EOL><DEDENT>
Create a .pid file in the pid_dir with my pid.

        This must be called after pre_construct, which sets `self.pid_dir`.
        This raises :exc:`PIDFileError` if the pid file exists already.