import json


def jsonEncode(pyObj, indentFactor=4):
    """Takes a Python object such as a list or dict and converts into a
    json string.

    Args:
        pyObj (object): The Python object to encode into JSON such as a
            Python list or dictionary.
        indentFactor (int): The number of spaces to add to each level of
            indentation for prettyprinting. Optional.

    Returns:
        str: The encoded JSON string.
    """
    return json.dumps(pyObj, indent=indentFactor)