def METHOD_NAME(
    user: User,
    address: "Address",
    address_type: str,
    manager: "PluginsManager",
):
    """Add address to user address book and set as default one."""
    # user can only have specified number of addresses
    # so we do not want to store additional one if user already reached the max
    # number of addresses
    if is_user_address_limit_reached(user):
        return
    address = manager.change_user_address(address, address_type, user)
    address_data = address.as_data()
    address = user.addresses.filter(**address_data).first()
    if address is None:
        address = user.addresses.create(**address_data)
    if address_type == AddressType.BILLING:
        if not user.default_billing_address:
            set_user_default_billing_address(user, address)
    elif address_type == AddressType.SHIPPING:
        if not user.default_shipping_address:
            set_user_default_shipping_address(user, address)