<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_from_path(self):
 """If catalog is named 'catalog' take name from parent directory"""

        name = os.path.splitext(os.path.basename(self.path))[0]
        if name == 'catalog':
            name = os.path.basename(os.path.dirname(self.path))
        return name.replace('.', '_')