def METHOD_NAME(self, obj, property_name, property_value):  # pylint: disable=no-self-use
    """Set property for RoleDefinition and RoleAssignment object.
    Luckily this function is only called for an RoleAssignment `obj` returned by the service, and `properties`
     has been processed, either by being flattened or set. We can definitively know whether `obj` is flattened
     or not.
    There is NO use case where `obj` is provided by the user and `properties` has not been processed.
     In such case, we won't be able to decide if `obj` is flattened or not."""
    if isinstance(obj, dict):
        if 'properties' in obj:
            obj = obj['properties']
        obj[property_name] = property_value
    else:
        if hasattr(obj, 'properties'):
            obj = obj.properties
        obj.property_name = property_value