def write_payload(payload=None, objectInput=None):
    """
    This function writes a base64 payload or file object on disk.

    Args:
        payload (string): payload in base64
        objectInput (object): file object/standard input to analyze

    Returns:
        Path of file
    """

    temp = tempfile.mkstemp()[1]
    log.debug("Write payload in temp file {!r}".format(temp))

    with open(temp, 'wb') as f:
        if payload:
            payload = base64.b64decode(payload)
        elif objectInput:
            if six.PY3:
                payload = objectInput.buffer.read()
            elif six.PY2:
                payload = objectInput.read()

        f.write(payload)

    return temp