How would I modify the following function which parses html string so that it returns a deferred promise?

```
function getProductName(html) {
  var temp = document.createElement('div');
  temp.innerHTML = html;
  var name;
  try {
    name = temp.querySelector('h1[itemprop*=\'name\']').textContent.trim();
    $log.debug('Name found: ' + name);
    return name;
  }
  catch(err) {
    return err;
  }
}

```