def _resolve_value(self, name):
name = str(name)<EOL>if name in self._metadata._meta.elements:<EOL><INDENT>element = self._metadata._meta.elements[name]<EOL>if element.editable:<EOL><INDENT>value = getattr(self, name)<EOL>if value:<EOL><INDENT>return value<EOL><DEDENT><DEDENT>populate_from = element.populate_from<EOL>if callable(populate_from):<EOL><INDENT>return populate_from(self, **self._populate_from_kwargs())<EOL><DEDENT>elif isinstance(populate_from, Literal):<EOL><INDENT>return populate_from.value<EOL><DEDENT>elif populate_from is not NotSet:<EOL><INDENT>return self._resolve_value(populate_from)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>value = getattr(self._metadata, name)<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if callable(value):<EOL><INDENT>if getattr(value, '<STR_LIT>', None):<EOL><INDENT>return value(self)<EOL><DEDENT>else:<EOL><INDENT>return value(self._metadata, self)<EOL><DEDENT><DEDENT>return value<EOL><DEDENT>
Returns an appropriate value for the given name.