code: def get_file_path_validator(default_file_param=None):
      
  
      def validator(namespace):
          if not hasattr(namespace, 'path'):
              return
  
          path = namespace.path
          dir_name, file_name = os.path.split(path) if path else (None, '')
  
          if default_file_param and '.' not in file_name:
              dir_name = path
              file_name = os.path.split(getattr(namespace, default_file_param))[1]
          namespace.directory_name = dir_name
          namespace.file_name = file_name
          del namespace.path
  
      return validator
docs: Creates a namespace validator that splits out 'path' into 'directory_name' and 'file_name'.
      Allows another path-type parameter to be named which can supply a default filename.