'Update a single feed.
Returns number of newly fetched entries.'

def update_feed(self, feed, **options):

    new_entry_count = 0
    try:
        stream = self.fetch_feed(feed)
        if stream:
            log.debug(('Processing    %s:    %s' % (feed.shortname, feed.url)))
            if (('feed' in stream) and ('title' in stream.feed)):
                log.debug('Processing    title:    %s', stream.feed.title)
            dirty_feed = False
            if (('feed' in stream) and ('title' in stream.feed) and (feed.title != stream.feed.title)):
                feed.title = stream.feed.title
                dirty_feed = True
            elif (('feed' not in stream) or ('title' not in stream.feed)):
                log.warn("Feed    doesn't    have    a    title    property")
                log.info(stream)
            if dirty_feed:
                try:
                    feed.save()
                except KeyboardInterrupt:
                    raise
                except Exception as x:
                    log.error('Unable    to    update    feed')
                    log.exception(x)
            for entry in stream.entries:
                if self.save_entry(feed, entry):
                    new_entry_count += 1
            feed.delete_old_entries()
    except KeyboardInterrupt:
        raise
    except Exception as e:
        log.error('General    Error    starting    loop:    %s', e)
        log.exception(e)
    return new_entry_count
