Set credentials for Device authentication.

        Args:
          api_token (str): Token issued to your Application through the Gem
            Developer Console.
          device_token (str): Physical device identifier. You will receive this
            from a user.devices.create call or from users.create.
          email (str, optional): User's email address, required if user_url is
            not provided.
          user_url (str, optional): User's Gem url.
          override (boolean, optional): Replace existing Application credentials.
          fetch (boolean, optional): Return the authenticated User.

        Returns:
          An User object if `fetch` is True.

def authenticate_device(self, api_token, device_token, email=None,
                            user_url=None, override=False, fetch=True):
        """Set credentials for Device authentication.

        Args:
          api_token (str): Token issued to your Application through the Gem
            Developer Console.
          device_token (str): Physical device identifier. You will receive this
            from a user.devices.create call or from users.create.
          email (str, optional): User's email address, required if user_url is
            not provided.
          user_url (str, optional): User's Gem url.
          override (boolean, optional): Replace existing Application credentials.
          fetch (boolean, optional): Return the authenticated User.

        Returns:
          An User object if `fetch` is True.
        """
        if (self.context.has_auth_params('Gem-Device') and not override):
            raise OverrideError('Gem-Device')

        if (not api_token or
            not device_token or
            (not email and not user_url) or
            not self.context.authorize('Gem-Device',
                                       api_token=api_token,
                                       user_email=email,
                                       user_url=user_url,
                                       device_token=device_token)):
            raise AuthUsageError(self.context, 'Gem-Device')

        if fetch:
            user = self.user(email) if email else self.user()
            return user.refresh()
        else:
            return True