def requires_login(func, *args, **kwargs):
    """Decorator to check that the user is logged in. Raises `BetfairError`
    if instance variable `session_token` is absent.
    """
    self = args[0]
    if self.session_token:
        return func(*args, **kwargs)
    raise exceptions.NotLoggedIn()
Decorator to check that the user is logged in. Raises `BetfairError`
    if instance variable `session_token` is absent.