def _create_callback(self, function, wrap_result):
    """Create MPD command related response callback.
    """
    if not isinstance(function, Callable):
        return None
    def command_callback():
        # command result callback expects response from MPD as iterable lines,
        # thus read available lines from socket
        res = function(self, self._read_lines())
        # wrap result in iterator helper if desired
        if wrap_result:
            res = self._wrap_iterator(res)
        return res
    return command_callback
Create MPD command related response callback.