<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def directoryAdd(self, dir_key, key):
    '''Adds directory entry `key` to directory at `dir_key`.

    If the directory `dir_key` does not exist, it is created.
    '''
    key = str(key)

    dir_items = self.get(dir_key) or []
    if key not in dir_items:
      dir_items.append(key)
      self.put(dir_key, dir_items)