def _get_title(property_name, schema, property_section=None):
    """
    Get the title for the property name from the WRA Data Model Schema. Optionally, you can send the section of the
    schema where the property should be found. This avoids finding the wrong property name when the name
    is not unique.

    If the property name is not found it will return itself.

    :param property_name:    The property name to find.
    :type property_name:     str
    :param schema:           The WRA Data Model Schema.
    :type schema:            dict
    :param property_section: The section in the schema where the property can be found. This avoids the case where the
                             property_name is not unique in the schema.
    :type property_section:  str or None
    :return:                 The title as stated in the schema.
    :rtype:                  str
    """
    # search through definitions first
    if schema.get('definitions') is not None:
        if property_name in schema.get('definitions').keys():
            return schema.get('definitions').get(property_name).get('title')
    # search through properties
    if schema.get('properties') is not None:
        # is property_name in the main properties
        if property_name in schema.get('properties').keys() and property_section is None:
            return schema.get('properties').get(property_name).get('title')
        # is property_section part of the main properties
        if property_section in schema.get('properties').keys():
            property_type = schema.get('properties').get(property_section).get('type')
            if property_type is not None and 'array' in property_type:
                # move down into an array
                result = _get_title(property_name, schema.get('properties').get(property_section)['items'])
                if result != property_name:
                    return result
            elif property_type is not None and 'object' in property_type:
                # move down into an object
                result = _get_title(property_name, schema.get('properties').get(property_section))
                if result != property_name:
                    return result
        # don't recognise either property_name or property_section.
        # loop through each property to find an array or object to move down to
        for k, v in schema.get('properties').items():
            if v.get('type') is not None and 'array' in v['type']:
                # move down into an array
                result = _get_title(property_name, v['items'], property_section)
                if result != property_name:
                    return result
            elif v.get('type') is not None and 'object' in v['type']:
                # move down into an object
                result = _get_title(property_name, v, property_section)
                if result != property_name:
                    return result
    # can't find the property_name in the schema, return itself
    return property_name