<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_pid(self, pid=None):
 """Write the current processes PID to the pidfile location"""

    pid = pid or os.getpid()
    self.write_metadata_by_name(self._name, 'pid', str(pid))