def get_optional_element(content, element_name, index=0):
    """
    Gets an optional element from json string , or dictionary.
    :param content: The content from which the element needs to be retrieved.
    :param element_name: The name of the element
    :param index: Optional index in case the return is a collection of elements.
    """
    element = None if element_name not in content else content[element_name]
    if element is None:
        return None
    else:
        if isinstance(element, list):
            return element[index]
        elif isinstance(element, object):
            return element
        else:
            return str(element)