def METHOD_NAME(self, username, password):
    login_page = self._download_webpage(
        self._LOGIN_URL, None, 'Downloading login popup')
    def is_logged(webpage):
        return any(re.search(p, webpage) for p in (
            r'href=[\"|\']?/signout[\"|\']',
            r'>Logout<'))
    # already logged in
    if is_logged(login_page):
        return
    login_form = self._hidden_inputs(login_page)
    login_form.update({
        'username': username,
        'password': password,
    })
    post_url = self._search_regex(
        r'<form[^>]+class=["|\']signin-form["|\'] action=["|\'](?P<url>.+?)["|\']', login_page,
        'post url', default=self._LOGIN_URL, group='url')
    if not post_url.startswith('http'):
        post_url = compat_urlparse.urljoin(self._LOGIN_URL, post_url)
    response = self._download_webpage(
        post_url, None, 'Logging in',
        data=urlencode_postdata(login_form),
        headers={'Content-Type': 'application/x-www-form-urlencoded'})
    if not is_logged(response):
        error = self._html_search_regex(
            r'(?s)<p[^>]+class="alert-message[^"]*">(.+?)</p>',
            response, 'error message', default=None)
        if error:
            raise ExtractorError('Unable to login: %s' % error, expected=True)
        raise ExtractorError('Unable to log in')