def GetPDFMultiByteInt(s, i, fieldlen):
    """Get a multibyte int from a string of bytes

    Args:
      s: string of bytes
      i: int, offset in s to start getting the result
      fieldlen: int, how many bytes to get
    Returns:
      int: accumulated multibyte value (high order byte first in s)
    """

    ans = 0
    for k in range(i, i + fieldlen):
        ans = ans * 256 + ord(s[k])
    return (ans, i + fieldlen)