def _handle_managed_document(doc):
    """
    Unwrap a managed document without decrypting it, and convert
    the data to an ASCII string if necessary. We're just
    using this so that managed documents and the documents
    that depend on them can be linted.

    :param dict doc: A YAML document
    :returns: the processed document
    :rtype: dict
    """
    if "managedDocument" in doc["data"]:
        doc = doc["data"]["managedDocument"]
        if isinstance(doc["data"], bytes):
            doc["data"] = doc["data"].decode("ascii")
    return doc