def create_condition_resource(condition_id: str,
                              patient_reference: dict,
                              onset_datetime: str,
                              condition_code: dict,
                              severity = None) -> dict:
    """
    Create condition resource following the FHIR format
    (http://www.hl7.org/implement/standards/fhir/condition.html)
    """
    condition_resource = {
        "resourceType": "Condition",
        "id": condition_id,
        "subject": patient_reference,
        "code": condition_code,
    }

    if severity:
        condition_resource["severity"] = severity

    if onset_datetime:
        condition_resource["onsetDateTime"] = onset_datetime

    return condition_resource