Get the affinity between the "base user" and ``username``.

        .. note:: The data returned will be a namedtuple, with the affinity
                  and shared rated anime. This can easily be separated
                  as follows (using the user ``Luna`` as ``username``):

                  .. code-block:: python

                      affinity, shared = ma.calculate_affinity("Luna")

                  Alternatively, the following also works:

                  .. code-block:: python

                      affinity = ma.calculate_affinity("Luna")

                  with the affinity and shared available as
                  ``affinity.affinity`` and ``affinity.shared`` respectively.

        .. note:: The final affinity value may or may not be rounded,
                  depending on the value of :attr:`._round`, set at
                  class initialisation.

        :param str username: The username to calculate affinity with
        :return: (float affinity, int shared)
        :rtype: tuple

def calculate_affinity(self, username):
        """
        Get the affinity between the "base user" and ``username``.

        .. note:: The data returned will be a namedtuple, with the affinity
                  and shared rated anime. This can easily be separated
                  as follows (using the user ``Luna`` as ``username``):

                  .. code-block:: python

                      affinity, shared = ma.calculate_affinity("Luna")

                  Alternatively, the following also works:

                  .. code-block:: python

                      affinity = ma.calculate_affinity("Luna")

                  with the affinity and shared available as
                  ``affinity.affinity`` and ``affinity.shared`` respectively.

        .. note:: The final affinity value may or may not be rounded,
                  depending on the value of :attr:`._round`, set at
                  class initialisation.

        :param str username: The username to calculate affinity with
        :return: (float affinity, int shared)
        :rtype: tuple
        """
        scores = self.comparison(username)

        # Handle cases where the shared scores are <= 10 so
        # affinity can not be accurately calculated.
        if len(scores) <= 10:
            raise NoAffinityError("Shared rated anime count between "
                                  "`{}` and `{}` is less than eleven"
                                  .format(self._base_user, username))

        # Sort multiple rows of scores into two arrays for calculations.
        # E.G. [1,2], [3,4], [5,6] to [1,3,5], [2,4,6]
        values = scores.values()
        scores1, scores2 = list(zip(*values))

        pearson = calcs.pearson(scores1, scores2)
        pearson *= 100

        if self._round is not False:
            pearson = round(pearson, self._round)

        return models.Affinity(affinity=pearson, shared=len(scores))