def json_describe(o, fqdn, descriptor=None):
if descriptor is None or not isinstance(descriptor, dict):<EOL><INDENT>return {"<STR_LIT>": fqdn}<EOL><DEDENT>else:<EOL><INDENT>result = {"<STR_LIT>": fqdn}<EOL>for attr, desc in descriptor.items():<EOL><INDENT>if attr == "<STR_LIT>":<EOL><INDENT>value = o<EOL><DEDENT>else:<EOL><INDENT>if '<STR_LIT:.>' in attr:<EOL><INDENT>value = o<EOL>for cattr in attr.split('<STR_LIT:.>'):<EOL><INDENT>if hasattr(value, cattr):<EOL><INDENT>value = getattr(value, cattr, "<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>value = getattr(o, attr, "<STR_LIT>")<EOL><DEDENT><DEDENT>if "<STR_LIT>" in desc:<EOL><INDENT>for transform in desc["<STR_LIT>"]:<EOL><INDENT>if "<STR_LIT>" == transform[<NUM_LIT:0>:len("<STR_LIT>")]:<EOL><INDENT>value = _numpy_transform(transform, value)<EOL><DEDENT>elif "<STR_LIT>" == transform[<NUM_LIT:0>:len("<STR_LIT>")]:<EOL><INDENT>value = _scipy_transform(transform, value)<EOL><DEDENT>elif "<STR_LIT>" == transform[<NUM_LIT:0>:len("<STR_LIT>")]:<EOL><INDENT>value = _math_transform(transform, value)<EOL><DEDENT>elif "<STR_LIT>" in transform:<EOL><INDENT>args = desc["<STR_LIT:args>"] if "<STR_LIT:args>" in desc else []<EOL>kwds = desc["<STR_LIT>"] if "<STR_LIT>" in desc else {}<EOL>method = transform[len("<STR_LIT>"):]<EOL>value = _instance_transform(method, value, *args,**kwds)<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in desc:<EOL><INDENT>for si, sl in enumerate(desc["<STR_LIT>"]):<EOL><INDENT>if '<STR_LIT::>' in sl:<EOL><INDENT>name, slice = sl.split('<STR_LIT::>')<EOL><DEDENT>else:<EOL><INDENT>name, slice = str(si), sl<EOL><DEDENT>slvalue = value<EOL>for i in map(int, slice.split('<STR_LIT:U+002C>')):<EOL><INDENT>slvalue = slvalue[i]<EOL><DEDENT>result[name] = _array_convert(slvalue)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if "<STR_LIT>" in desc:<EOL><INDENT>result[desc["<STR_LIT>"]] = _array_convert(value)<EOL><DEDENT>else:<EOL><INDENT>result[attr] = _array_convert(value)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return result<EOL>
Describes the specified object using the directives in the JSON
    `descriptor`, if available.

    Args:
        o: object to describe.
        fqdn (str): fully-qualified domain name of the object.
        descriptor (dict): keys are attributes of `o`; values are transform
          functions to apply to the attribute so that only a single value is
          returned.

    Returns:
        dict: keys are specific attributes tailored to the specific object type,
        though `fqdn` is common to all descriptions; values are the corresponding
        attribute values which are *simple* types that can easily be serialized to
        JSON.