def __reference_type(typestr, is_reference):
    """Adapt the type string depending on whether it is used as a reference.

    Arguments:
      typestr      -- the type string to be modified
      is_reference -- boolean defining usage as reference (or not)
    Returns:
      the adapted type string"""

    if is_reference:
        typestr = 'const ' + typestr + '&'
    return typestr