<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_dimension(dimension_id, do_accept_dimension_id_none=False,**kwargs):
 """ Given a dimension id returns all its data """

    if do_accept_dimension_id_none == True and dimension_id is None:
        # In this special case, the method returns a dimension with id None
        return get_empty_dimension()

    try:
        dimension = db.DBSession.query(Dimension).filter(Dimension.id==dimension_id).one()

        #lazy load units
        dimension.units

        return JSONObject(dimension)
    except NoResultFound:
        # The dimension does not exist
        raise ResourceNotFoundError("Dimension %s not found"%(dimension_id))