def hhsex_recode(hhsex: int):
    """
    This is recoding the household histogram variable sex, which can only be 0 or 1, to the MDF HHSEX variable.
    The MDF specifies HHSEX variable as:
    0 = NIU
    1 = Male householder
    2 = Female householder
    """
    assert 0 <= hhsex <= 1, f'SEX must be between 0 and 1, inclusive. Found {hhsex} instead.'
    if hhsex == 0:
        return "1"
    return "2"