import six


def format_path_parameter(val):
    """
    Format a path paramater.

    Basically: convert to string, with a special rule for datetime objects.
    """
    if hasattr(val, 'identity'):
        val = val.identity()
    if hasattr(val, 'strftime'):
        val = val.strftime('%Y-%m-%dT%H:%M:%SZ')
    return six.text_type(val)