Disney+ Hotstar assembles content cards from arrays of metadata objects. Implement a pluck function that extracts the value at a specified property path from every record, preserving input order and leaving the original records unchanged.
The path may contain multiple property names separated by dots, such as "title" or "metadata.language". If any part of the path is missing, or an intermediate value is not an object, return None for that record.
records, a list of dictionaries, and path, a non-empty dot-separated string.None.records or any nested dictionary.def pluck(records, path):