def to_representation(self, value):
    value = getattr(value, self.related_field_name)
    if (self.serializer_field is not None):
        value = self.serializer_field.to_representation(value)
    return value
def to_representation(self, value):
    value = getattr(value, self.related_field_name)
    if (self.serializer_field is not None):
        value = self.serializer_field.to_representation(value)
    return value