'Decode an encrypted HTTP basic authentication string. Returns a tuple of
the form (email, password), and raises a HTTPBadRequest exception if
nothing could be decoded.
:param  encoded_str: BaseAuth string encoded base64
:type   encoded_str: string
:returns: email of the user
:rtype:   string
:returns: password of the user
:rtype:   string
:raises: HTTPBadRequest'

def _decode_baseauth(self, encoded_str):

    split = encoded_str.strip().split('    ')
    if (len(split) == 1):
        try:
            (email, password) = b64decode(split[0]).split(':')
        except:
            raise exceptions.ActionInputError()
    elif (len(split) == 2):
        if (split[0].strip().lower() == 'basic'):
            try:
                (email, password) = b64decode(split[1]).split(':')
            except:
                raise exceptions.ActionInputError()
        else:
            raise exceptions.ActionInputError()
    else:
        raise exceptions.ActionInputError()
    return (unquote(email), unquote(password))
