MRM campaign calendars store dates internally as YYYY-MM-DD, but different campaign surfaces may need to display them in a specified field order. Write a function that rearranges the date fields and joins them with the requested separator.
Implement format_date(date, order, separator), where:
date is a string in the format YYYY-MM-DD.order is a three-character string containing Y, M, and D exactly once each.separator is a non-empty string used between output fields.Do not use locale-dependent date formatting. The function should work directly from the date string.
date always matches YYYY-MM-DD.1000 <= YYYY <= 9999.01 <= MM <= 12.01 <= DD <= 31, with valid calendar dates guaranteed.order contains Y, M, and D exactly once each.1 <= len(separator) <= 3.def format_date(date, order, separator):