def can_edit_address(user, address):
    """Determine whether the user can edit the given address.

    This method assumes that an address can be edited by:
    - users with proper permission (staff)
    - customers who "own" the given address.
    """
    has_perm = user.has_perm("account.manage_users")
    belongs_to_user = address in user.addresses.all()
    return has_perm or belongs_to_user