<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def name(self):
 """ Name of the torrent Default to last item in :attr:`path` or ``None`` if :attr:`path` is ``None``. Setting this property sets or removes ``name`` in :attr:`metainfo`\ ``['info']``. """

        if 'name' not in self.metainfo['info'] and self.path is not None:
            self.metainfo['info']['name'] = os.path.basename(self.path)
        return self.metainfo['info'].get('name', None)