def METHOD_NAME(path, metadata_filename=METADATA_FILE):
    metadata_path = path / metadata_filename
    try:
        if metadata_filename == METADATA_FILE:
            metadata = Metadata.from_file(metadata_path)
            return metadata
        elif metadata_filename == DATASET_METADATA_FILE:
            metadata = DatasetMetadata.from_file(metadata_path)
            return metadata
        else:
            raise Exception(f"Invalid metadata filename provided - {metadata_filename}")
    except FileNotFoundError:
        logging.warning(f"Metadata not found at {str(metadata_path)}")